Kubernetes: Verificando o estado do Kubernetes após a configuração

From Wiki

Verificação inicial

  • Verificando o estado dos nodes
kubectl get nodes

O Status correto deve ser Ready, é preciso verificar os status NotReady.

  • Detalhes
kubectl describe nodes


  • Verificando o estado dos pods
kubectl get pods --all-namespaces -o wide

O Status correto deve ser Running, é preciso verificar os status Pending, ContainerCreating, ImagePullBackOff.

  • Verificando o journalctl, para verificar o status do kubelet
journalctl -n 100 -xu kubelet

retorna as 100 linhas do kubelet

Acompanhando

journcalctl -f -u kubelet

Troubleshooting 1 - Problemas com Calico

kubectl get nodes
NAME           STATUS     ROLES     AGE       VERSION
server000001   NotReady   master    21h       v1.11.9
server000002   NotReady   <none>    19h       v1.11.9
server000003   NotReady   <none>    19h       v1.11.9

Meus nodes estão com o status NotReady

kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                   READY     STATUS              RESTARTS   AGE       IP               NODE           NOMINATED NODE
kube-system   calico-node-77zqw                      0/2       ContainerCreating   0          19h       172.17.133.113   server000003   <none>
kube-system   calico-node-9896s                      0/2       ContainerCreating   0          19h       172.17.133.112   server000002   <none>
kube-system   calico-node-9xngd                      0/2       ImagePullBackOff    0          19h       172.17.133.111   server000001   <none>
kube-system   coredns-78fcdf6894-fkzcr               0/1       Pending             0          21h       <none>           <none>         <none>
kube-system   coredns-78fcdf6894-lzz25               0/1       Pending             0          21h       <none>           <none>         <none>
kube-system   etcd-hxl1scb00017                      1/1       Running             1          21h       172.17.133.111   server000001   <none>
kube-system   kube-apiserver-hxl1scb00017            1/1       Running             0          21h       172.17.133.111   server000001   <none>
kube-system   kube-controller-manager-hxl1scb00017   1/1       Running             0          21h       172.17.133.111   server000001   <none>
kube-system   kube-proxy-qllcx                       0/1       ContainerCreating   0          19h       172.17.133.113   server000003   <none>
kube-system   kube-proxy-wxphc                       0/1       ContainerCreating   0          19h       172.17.133.112   server000002   <none>
kube-system   kube-proxy-xvljr                       1/1       Running             0          21h       172.17.133.111   server000001   <none>
kube-system   kube-scheduler-hxl1scb00017            1/1       Running             1          21h       172.17.133.111   server000001   <none>

Meus pods estão com o status Pending, ImagePullBackOff e ContainerCreating.

Verificando o journalctl

 journalctl -n 100 -u kubelet

...
Aug 14 12:10:00 server000001 kubelet[52727]: E0814 12:10:00.659426   52727 kubelet.go:2106] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network p
Aug 14 12:10:04 server000001 kubelet[52727]: E0814 12:10:04.837493   52727 dns.go:180] CheckLimitsForResolvConf: Resolv.conf file '/etc/resolv.conf' contains search line consisting of more than 3 domain
Aug 14 12:10:05 server000001 kubelet[52727]: W0814 12:10:05.663617   52727 cni.go:172] Unable to update cni config: No networks found in /etc/cni/net.d
...
Aug 14 14:09:06 server000001 kubelet[52727]: , failed to "StartContainer" for "install-cni" with ImagePullBackOff: "Back-off pulling image \"calico/cni:v3.3.6\""
...

Problema: "CheckLimitsForResolvConf: Resolv.conf ..."

Pelo log "file '/etc/resolv.conf' contains search line consisting of more than 3 domain". O kubernetes precisa que o número de domínios no /etc/resolv.conf tenha no máximo 3 domínios.

Problema: "No networks found in /etc/cni/net.d"

Problema: "ImagePullBackOff"

O kubernetes não consegue baixar uma imagem.

Exemplo:

Aug 14 14:09:06 server000001 kubelet[52727]: , failed to "StartContainer" for "install-cni" with ImagePullBackOff: "Back-off pulling image \"calico/cni:v3.3.6\""

Caso você não tenha acesso ao repositório na internet, veja o artigo Kubernetes: Instalação Offline ou Instalação usando repositórios privados

Ver também