You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the reboot the master nodes came back online, but none of our applications are accessible.
Check the status of the applications on the cluster. What's wrong?
controlplane $ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-f9fd979d6-4nx4p 1/1 Running 0 31m
kube-system coredns-f9fd979d6-fxzw9 1/1 Running 0 31m
kube-system etcd-controlplane 1/1 Running 0 31m
kube-system kube-apiserver-controlplane 1/1 Running 0 31m
kube-system kube-controller-manager-controlplane 1/1 Running 0 31m
kube-system kube-flannel-ds-amd64-xc2cm 1/1 Running 0 30m
kube-system kube-flannel-ds-amd64-z94jf 1/1 Running 0 31m
kube-system kube-proxy-84d2s 1/1 Running 0 31m
kube-system kube-proxy-hfpdv 1/1 Running 0 30m
kube-system kube-scheduler-controlplane 1/1 Running 0 31m
controlplane $ kubectl get deployment --all-namespaces
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system coredns 2/2 2 2 31m
controlplane $ kubectl get services --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 96s
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 31m
Luckily we took a backup. Restore the original state of the cluster using the backup file.
Deployments: 2
Services: 3
controlplane $ ETCDCTL_API=3 etcdctl help| grep restore
snapshot restore Restores an etcd member snapshot to an etcd directory
ETCDCTL_API=3 etcdctl --data-dir /var/lib/etcd-from-backup \
snapshot restore /opt/snapshot-pre-boot.db
controlplane $ ls /var/lib/etcd-from-backup
member
controlplane $ cd /etc/kubernetes/manifests/
controlplane $ ls
etcd.yaml kube-apiserver.yaml kube-controller-manager.yaml kube-scheduler.yaml
## make following changes
controlplane $ cat etcd.yaml | grep -i from-backup -A 1 -B 1
- hostPath:
path: /var/lib/etcd-from-backup
type: DirectoryOrCreate
## check the process restarted as its static pod
controlplane $ docker ps | grep -i etcd
1160b22e5eee d4ca8726196c "etcd --advertise-cl…" About a minute ago Up About a minute k8s_etcd_etcd-controlplane_kube-system_3c7d14374da0d8247e20e917856facae_0
5b05b3e493b7 k8s.gcr.io/pause:3.2 "/pause" About a minute ago Up About a minute
## now the applications are backup
controlplane $ kubectl get pods
NAME READY STATUS RESTARTS AGE
blue-746c87566d-92l8p 1/1 Running 0 32m
blue-746c87566d-mnd6s 1/1 Running 0 32m
blue-746c87566d-n59pl 1/1 Running 0 32m
red-75f847bf79-g7258 1/1 Running 0 32m
red-75f847bf79-vch5j 1/1 Running 0 32m k8s_POD_etcd-controlplane_kube-system_3c7d14374da0d8247e20e917856facae_0