Are you looking for somewhere to learn more about Kubernetes interview questions? You’re in the right place! We publish a Kubernetes question every day on our social media channels, LinkedIn, Telegram, and YouTube, and at the end of the week, we provide the correct answers with details here. If you want to test your Kubernetes knowledge or prepare yourself for Kubernetes role interviews, follow our social media.
Which Kubernetes component is responsible for routing Service traffic to Pods?
kube-proxy is the component which is responsible for routing Service traffic to Pods. It can be run in two modes on Linux machines. iptables mode or ipvs mode. In both cases, kube-proxy configures the underlying service to route traffic from ClusterIP to Pods.
Can we run a Pod without installing the CNI plugin?
Yes, we can. We can run a Kubernetes Pod in hostNetwork mode without installing any CNI plugins. When a Pod is defined with hostNetwork option, the Linux network namespace will not created for that, and the host machine network stack will be shared with the Pod’s containers. In that case, containers do not need any CNI plugin to assign them any network interfaces, configurations, etc.
02 October 2023:
Which components are mandatory to run a Pod?
D) All of them
Although all components are necessary and should be installed to run a Pod in normal use cases, kubelet is the only mandatory component to run a Pod, and you can run Pods without having kube-apiserver and kube-scheduler installed. With only having kubelet and container runtime, you can run static Pods on your machine.
What will happen to Pods if the CNI plugin gets removed?
A) Cluster will go out of reach
B) All Pods will go out of reach
C) All Pods will go to the Pending state
D) New Pods will remain in the Pending state
Although it depends on the CNI, in most cases, removing the CNI plugin “removing CNI binaries, config files, etc.” will only affect new Pods as they can’t run without getting network configuration and IP address from the CNI plugin, but already existing Pods have their configurations, and they can work without issue.
04 October 2023:
What is the Almighty “pause” container in Kubernetes?
A) It’s a special container to pause deployments
B) It’s a special container to run the root privilege containers
C) It’s a special container to share network namespace with Pod’s containers
D) It’s a special container to pause cron jobs
If you look at the container runtime outputs, you can find that for every Kubernetes Pod, there is one “pause” container. When you run a Kubernetes Pod, at least two containers will be run. One container is the main container, as defined in PodSpec, and one container is the pause container, which runs before the main container and shares its network namespace “can share PID namespace as well” with the main container.
How can we bypass kube-scheduler and run a Pod without scheduling?
A) By adding nodeName in Pod spec
B) By adding nodeSelector in Pod spec
C) By adding topologySpreadConstraints in Pod spec
D) By adding affinity in Pod spec
When the nodeName field of the Pod is not empty, the kube-scheduler ignores it from the scheduling decisions, and the kubelet of the mentioned node will try to run the Pod. If you provide a non-existing node, the Pod will remain in the Pending state.
What happens if you remove a PersistentVolumeClaim in active use?
A) The Pod will be crashed, and PVC will be removed
B) All data will gone as soon as we delete the PVC resource
C) We can’t delete a PVC during active use
D) It will be deleted as soon as Pod gets stopped
Kubernetes provides a way to protect data from accidental loss/deletion. In the case of PVC deletion, if you remove a PVC in active use, “one or more running Pods are mounting it”, it’s not removed immediately. Instead, it waits until no one uses the PVC, then removes it. This protection provides you a way to get a backup of data just before deletion.
Kubernetes itself is wild. Man vs. Wild in interviews needs deep knowledge, hands-on experience and additional skills to pass. If you want to pass Kubernetes role interviews, read more and do many more with Kubernetes. Our goal in Kubedemy is to help you understand and solve Kubernetes difficulties in all situations.
If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.