n-guitar/k8s-bootcamp

scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused

Closed this issue · 2 comments

再現

$ kubectl get componentstatuses 
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME                 STATUS      MESSAGE                                                                                       ERROR
scheduler            Unhealthy   Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused   
controller-manager   Healthy     ok                                                                                            
etcd-0               Healthy     {"health":"true","reason":""}     
$ kubectl get pod -n kube-system
NAME                                       READY   STATUS    RESTARTS   AGE
calico-kube-controllers-685b65ddf9-7tvmv   1/1     Running   0          82m
calico-node-4nf8n                          1/1     Running   0          82m
calico-node-gg6dv                          1/1     Running   0          48m
coredns-78fcd69978-79s2b                   1/1     Running   0          82m
coredns-78fcd69978-9nxwg                   1/1     Running   0          82m
etcd-master-node                           1/1     Running   0          82m
kube-apiserver-master-node                 1/1     Running   0          82m
kube-controller-manager-master-node        1/1     Running   0          82m
kube-proxy-4r6lj                           1/1     Running   0          48m
kube-proxy-ft9xn                           1/1     Running   0          82m
kube-scheduler-master-node                 1/1     Running   0          82m
metrics-server-599cd48df7-4gb6h            0/1     Running   0          82m

https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/
--port=0
フラグはもう既に動作していない(非推奨)のためコメントアウト

$ sudo vim /etc/kubernetes/manifests/kube-scheduler.yaml
$ sudo systemctl restart kubelet
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    component: kube-scheduler
    tier: control-plane
  name: kube-scheduler
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-scheduler
    - --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
    - --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
    - --bind-address=127.0.0.1
    - --kubeconfig=/etc/kubernetes/scheduler.conf
    - --leader-elect=true
    #- --port=0
    image: k8s.gcr.io/kube-scheduler:v1.22.10
    imagePullPolicy: IfNotPresent
    livenessProbe: