Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docker_advanced_k8s_troubleshooting [2020/05/22 14:42] – created andonovj | docker_advanced_k8s_troubleshooting [2020/05/25 12:47] (current) – [Not installed NFS Client (NFS Dynamic Provisioning)] andonovj | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | TODO | + | =====Overview===== |
+ | Eventhough Kuberentes is pretty easy to configure, it is prone to problems, especailly if you do it on vagrant. So let's check which tools we can use, to monitor it: | ||
+ | |||
+ | |||
+ | Firstly we can get a component using the get command: | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | NAME | ||
+ | busybox | ||
+ | first-pod | ||
+ | hello-deploy-7f44bd8b96-2xz8j | ||
+ | hello-deploy-7f44bd8b96-4c76j | ||
+ | hello-deploy-7f44bd8b96-7tvcs | ||
+ | hello-deploy-7f44bd8b96-9lnrm | ||
+ | hello-deploy-7f44bd8b96-dckq2 | ||
+ | hello-deploy-7f44bd8b96-gnvwr | ||
+ | hello-deploy-7f44bd8b96-p66g8 | ||
+ | hello-deploy-7f44bd8b96-qtxgk | ||
+ | hello-deploy-7f44bd8b96-qz6cr | ||
+ | hello-deploy-7f44bd8b96-r7g4q | ||
+ | nfs-client-provisioner-98cdf7875-26nbg | ||
+ | nfs-client-provisioner-98cdf7875-kdcvv | ||
+ | </ | ||
+ | |||
+ | |||
+ | As you can see, we have 2 failing pods, but we don't know why. This is where the " | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | Name: | ||
+ | Namespace: | ||
+ | Priority: | ||
+ | Node: | ||
+ | Start Time: Sat, 23 May 2020 13:04:31 +0000 | ||
+ | Labels: | ||
+ | pod-template-hash=98cdf7875 | ||
+ | Annotations: | ||
+ | Status: | ||
+ | IP: | ||
+ | IPs: | ||
+ | IP: | ||
+ | Controlled By: ReplicaSet/ | ||
+ | Containers: | ||
+ | nfs-client-provisioner: | ||
+ | Container ID: | ||
+ | Image: | ||
+ | Image ID: | ||
+ | Port: < | ||
+ | Host Port: < | ||
+ | State: | ||
+ | Reason: | ||
+ | Last State: | ||
+ | Reason: | ||
+ | Exit Code: 255 | ||
+ | Started: | ||
+ | Finished: | ||
+ | Ready: | ||
+ | Restart Count: | ||
+ | Environment: | ||
+ | PROVISIONER_NAME: | ||
+ | NFS_SERVER: | ||
+ | NFS_PATH: | ||
+ | Mounts: | ||
+ | / | ||
+ | / | ||
+ | Conditions: | ||
+ | Type Status | ||
+ | Initialized | ||
+ | Ready | ||
+ | ContainersReady | ||
+ | PodScheduled | ||
+ | Volumes: | ||
+ | nfs-client-root: | ||
+ | Type: NFS (an NFS mount that lasts the lifetime of a pod) | ||
+ | Server: | ||
+ | Path: / | ||
+ | ReadOnly: | ||
+ | nfs-client-provisioner-token-ldqw7: | ||
+ | Type: Secret (a volume populated by a Secret) | ||
+ | SecretName: | ||
+ | Optional: | ||
+ | QoS Class: | ||
+ | Node-Selectors: | ||
+ | Tolerations: | ||
+ | | ||
+ | Events: | ||
+ | Type | ||
+ | ---- | ||
+ | Normal | ||
+ | Normal | ||
+ | Normal | ||
+ | Normal | ||
+ | Normal | ||
+ | Warning | ||
+ | ubuntu@k8s-master: | ||
+ | </ | ||
+ | |||
+ | But even that, doesn' | ||
+ | |||
+ | Firstly, let's check the logs: | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | Error from server (NotFound): the server could not find the requested resource ( pods/log nfs-client-provisioner-98cdf7875-26nbg) | ||
+ | ubuntu@k8s-master: | ||
+ | </ | ||
+ | |||
+ | Well, that is specific issue to Vagrant configuration. | ||
+ | The problem here is the fact that, the vagrant is using 10.0.2.15 IP as default IP, well that isn't the IP which you want for your kubernetes' | ||
+ | < | ||
+ | Environment=" | ||
+ | </ | ||
+ | |||
+ | After that, we have to restart the kubelete using one of the following commands, (guess which one) | ||
+ | < | ||
+ | systemctl stop kubelet | ||
+ | systemctl start kubelet | ||
+ | systemctl restart kubelet | ||
+ | systemctl status kubelet | ||
+ | </ | ||
+ | |||
+ | But to be honest, better restart the whole Kubernetes :) | ||
+ | After that all should be running under the correct IPs: | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | NAMESPACE | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | ubuntu@k8s-master: | ||
+ | ubuntu@k8s-master: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | 2020-05-25 07: | ||
+ | </ | ||
+ | |||
+ | =====Specific Problems===== | ||
+ | Let's dwelves into more specific problems: | ||
+ | |||
+ | ====Wrong Api Version==== | ||
+ | If you have a wrong Api version in teh YML file, you will receive the following error: | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | error: unable to recognize " | ||
+ | </ | ||
+ | |||
+ | To fix that, find where that image has been moved, most probably for newer versions of Kubernetes is: | ||
+ | |||
+ | < | ||
+ | ubuntu@k8s-master: | ||
+ | apiVersion: apps/v1 | ||
+ | </ | ||
+ | |||
+ | Bare in mind that can of course change. | ||
+ | |||
+ | ====Not installed NFS Client (NFS Dynamic Provisioning)==== | ||
+ | In case you have NFS dynamic provisioning and you didn't install NFS client on ALL nodes of the cluster, you will get the following error, when you try to create a POD which is to be placed there. | ||
+ | |||
+ | < | ||
+ | Mounting command: systemd-run | ||
+ | Mounting arguments: --description=Kubernetes transient mount for / | ||
+ | Output: Running scope as unit run-r94910a4067104f079e9aae302b111ab2.scope. | ||
+ | mount: wrong fs type, bad option, bad superblock on 10.111.172.167:/ | ||
+ | | ||
+ | (for several filesystems (e.g. nfs, cifs) you might | ||
+ | need a / | ||
+ | |||
+ | In some cases useful info is found in syslog - try | ||
+ | dmesg | tail or so. | ||
+ | Warning | ||
+ | </ | ||
+ | |||
+ | To fix that, just install the NFS client on all the nodes: | ||
+ | |||
+ | < | ||
+ | root@node-1: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree | ||
+ | Reading state information... Done | ||
+ | The following additional packages will be installed: | ||
+ | keyutils libnfsidmap2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libtirpc1 python python-minimal python2.7 python2.7-minimal rpcbind | ||
+ | Suggested packages: | ||
+ | watchdog python-doc python-tk python2.7-doc binfmt-support | ||
+ | The following NEW packages will be installed: | ||
+ | keyutils libnfsidmap2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libtirpc1 nfs-common python python-minimal python2.7 python2.7-minimal rpcbind | ||
+ | 0 upgraded, 12 newly installed, 0 to remove and 40 not upgraded. | ||
+ | Need to get 4,258 kB of archives. | ||
+ | After this operation, 18.0 MB of additional disk space will be used. | ||
+ | Do you want to continue? [Y/n] Y | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | root@node-1: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree | ||
+ | Reading state information... Done | ||
+ | The following additional packages will be installed: | ||
+ | keyutils libnfsidmap2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libtirpc1 python python-minimal python2.7 python2.7-minimal rpcbind | ||
+ | Suggested packages: | ||
+ | watchdog python-doc python-tk python2.7-doc binfmt-support | ||
+ | The following NEW packages will be installed: | ||
+ | keyutils libnfsidmap2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libtirpc1 nfs-common python python-minimal python2.7 python2.7-minimal rpcbind | ||
+ | 0 upgraded, 12 newly installed, 0 to remove and 40 not upgraded. | ||
+ | Need to get 4,258 kB of archives. | ||
+ | After this operation, 18.0 MB of additional disk space will be used. | ||
+ | Do you want to continue? [Y/n] Y | ||
+ | </ |