我通过从其他工作窗格(nginx应用程序)中复制粘贴配置(values.yaml,requirements.yaml,子图表)并更改所有名称来创建了一个新窗格。 重新部署后,我的新Pod无限期处于待处理状态,当我描述它时,会发生以下事件:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling <unknown> default-scheduler 0/19 nodes are available: 19 node(s) had taints that the pod didn't tolerate.
这并不能告诉我很多。我如何获得更多详细信息以了解为什么调度完全失败?
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "xyz.fullname" . }}
labels:
app: {{ template "xyz.name" . }}
chart: {{ template "xyz.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "xyz.name" . }}
release: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
labels:
app: {{ template "xyz.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
volumes:
- name: confd
configMap:
name: {{ template "xyz.fullname" . }}
items:
- key: resolver
path: resolver.conf
- name: nginx-config
configMap:
name: {{ template "xyz.fullname" . }}
items:
- key: nginxConf
path: default
containers:
- name: {{ template "xyz.fullname" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: /etc/nginx/conf.d
name: confd
- mountPath: /etc/nginx/sites-enabled
name: nginx-config
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
env:
- name: XYZ_API_URL
value: {{ .Release.Name }}-xyz-api
{{- if .Values.environment }}
{{- range $key, $value := .Values.environment }}
- name: {{ toYaml $key }}
value: {{ toYaml $value }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
get no --show-labels
NAME STATUS ROLES AGE VERSION LABELS
k8s-app-stg-c1-01 Ready <none> 328d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-01,kubernetes.io/os=linux,role=preemptible
k8s-app-stg-c1-02 Ready <none> 328d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-02,kubernetes.io/os=linux,role=preemptible
k8s-app-stg-c1-03 Ready <none> 328d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-03,kubernetes.io/os=linux,role=preemptible
k8s-app-stg-c1-04 Ready <none> 297d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-04,kubernetes.io/os=linux,role=preemptible
k8s-app-stg-c1-05 Ready <none> 297d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-05,kubernetes.io/os=linux,role=preemptible
k8s-app-stg-c1-06 Ready <none> 24d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=app,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-app-stg-c1-06,kubernetes.io/os=linux,role=preemtible
k8s-bi-stg-c1-01 Ready <none> 212d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=bi,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-bi-stg-c1-01,kubernetes.io/os=linux
k8s-ci-stg-c1-01 Ready <none> 60d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=ci,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-ci-stg-c1-01,kubernetes.io/os=linux,role=preemtible
k8s-ci-stg-c1-02 Ready <none> 41d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=ci,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-ci-stg-c1-02,kubernetes.io/os=linux,role=preemtible
k8s-ci-stg-c1-03 Ready <none> 41d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=ci,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-ci-stg-c1-03,kubernetes.io/os=linux,role=preemtible
k8s-ci-stg-c1-04 Ready <none> 41d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=ci,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-ci-stg-c1-04,kubernetes.io/os=linux,role=preemtible
k8s-master-stg-c1-01 Ready master 1y v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master-stg-c1-01,kubernetes.io/os=linux,node-role.kubernetes.io/master=
k8s-master-stg-c1-02 Ready master 1y v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master-stg-c1-02,kubernetes.io/os=linux,node-role.kubernetes.io/master=
k8s-master-stg-c1-03 Ready master 1y v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master-stg-c1-03,kubernetes.io/os=linux,node-role.kubernetes.io/master=
k8s-svc-stg-c1-01 Ready <none> 326d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=svc,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-svc-stg-c1-01,kubernetes.io/os=linux,role=preemptible
k8s-svc-stg-c1-02 Ready <none> 325d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=svc,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-svc-stg-c1-02,kubernetes.io/os=linux,role=preemptible
k8s-svc-stg-c1-03 Ready <none> 325d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=svc,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-svc-stg-c1-03,kubernetes.io/os=linux,role=preemptible
k8s-svc-stg-c1-04 Ready <none> 297d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=svc,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-svc-stg-c1-04,kubernetes.io/os=linux,role=preemptible
k8s-svc-stg-c1-05 Ready <none> 297d v1.16.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,esxcluster=svc,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-svc-stg-c1-05,kubernetes.io/os=linux,role=preemptible
答案 0 :(得分:1)
我认为@ P-Ekambaram先前的回答应该详细说明。
您的pod
处于待处理状态,因为您的节点由于污点而无法接受它。
Taints
允许节点排斥一组吊舱。使用公差
您可以将Pod安排到具有匹配污点的节点中。
污点如何工作的最佳快速示例就是简单地创建单节点kubernetes集群。
在这种情况下,您将从名为taint
的主节点中删除master:NoSchedule
这将允许您在主节点上计划Pod。
当您要为特定目的保留一些节点集时,这也非常有用,这样您可以安排需要它们的Pod。
回到您的错误状态,您必须在与这些异味相匹配的吊舱规格下添加公差,以便对其进行安排。
您可以使用以下命令列出污渍(使用jq
是必需的):
kubectl get nodes -o json | jq '.items[].spec.taints'
污染的格式如下:
`<key>=<value>:<effect>`
<effect>
告诉kubernetes调度程序的内容
应该碰到不容忍这种异味的豆荚。
以下是这些容忍度在豆荚Yamls中的显示示例:
tolerations:
- key: "key"
operator: "Equal"
value: "value"
Kubernetes文档很好地解释了taints and tolerations。
答案 1 :(得分:-1)
您可以使用'esxcluster'OR role = preemptible标签将您的工作负载调度到适当的节点。您可能需要将节点选择器和公差添加到传递给头盔安装命令的values.yaml中