10X Sale
kh logo
All Courses

Introduction

Kubernetes is an open-source container orchestration platform designed to manage containerized workloads and services, making it easy to deploy and manage large-scale, microservices-based applications. Prepare better for your interview with the top Kubernetes interview questions curated by our experts. These Kubernetes Interview Questions and Answers will help you transition to a top DevOps job role.

We have covered conceptual questions for freshers and experts and will help you answer different questions like the difference between config map and secret, monitoring, ways to test a manifest, automatic load balancing, rolling updates, self-healing, and horizontal scaling. With these Kubernetes Interview Questions with detailed answers as your resource, you can be confident that you will be well-prepared for your next interview. Prepare well and crack your interview with ease and confidence! Get well prepared with these interview questions and answers for Kubernetes.

Kubernetes Interview Questions and Answers
Intermediate

1. What is the difference between config map and secret? (Differentiate the answers as with examples)

Config maps ideally stores application configuration in a plain text format whereas Secrets store sensitive data like password in an encrypted format. Both config maps and secrets can be used as volume and mounted inside a pod through a pod definition file.

Config map:

                 kubectl create configmap myconfigmap
 --from-literal=env=dev

Secret:

echo -n ‘admin’ > ./username.txt
echo -n ‘abcd1234’ ./password.txt
kubectl create secret generic mysecret --from-file=./username.txt --from-file=./password.txt

2. If a node is tainted, is there a way to still schedule the pods to that node?

When a node is tainted, the pods don't get scheduled by default, however, if we have to still schedule a pod to a tainted node we can start applying tolerations to the pod spec.

Apply a taint to a node:

kubectl taint nodes node1 key=value:NoSchedule

Apply toleration to a pod:

spec:
tolerations:
- key: "key"
operator: "Equal"
value: "value"
effect: "NoSchedule"

This is one of the most frequently asked Kubernetes interview questions for freshers in recent times.

3. Can we use many claims out of a persistent volume? Explain?

The mapping between persistentVolume and persistentVolumeClaim is always one to one. Even When you delete the claim, PersistentVolume still remains as we set persistentVolumeReclaimPolicy is set to Retain and It will not be reused by any other claims. Below is the spec to create the Persistent Volume.

apiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain

4. What kind of object do you create, when your dashboard like application, queries the Kubernetes API to get some data?

You should be creating serviceAccount. A service account creates a token and tokens are stored inside a secret object. By default Kubernetes automatically mounts the default service account. However, we can disable this property by setting automountServiceAccountToken: false in our spec. Also, note each namespace will have a service account

apiVersion: v1
kind: ServiceAccount
metadata:
name: my-sa
automountServiceAccountToken: false

5. What is the difference between a Pod and a Job? Differentiate the answers as with examples)

A Pod always ensure that a container is running whereas the Job ensures that the pods run to its completion. Job is to do a finite task.

Examples:

kubectl run mypod1 --image=nginx --restart=Never
kubectl run mypod2 --image=nginx --restart=onFailure
○ → kubectl get pods
NAME           READY STATUS   RESTARTS AGE
mypod1         1/1 Running   0 59s
○ → kubectl get job
NAME     DESIRED SUCCESSFUL   AGE
mypod1   1 0            19s

Want to Know More?
+91

By Signing up, you agree to ourTerms & Conditionsand ourPrivacy and Policy

Description

Kubernetes is an open-source container orchestration platform designed to manage containerized workloads and services, making it easy to deploy and manage large-scale, microservices-based applications. Prepare better for your interview with the top Kubernetes interview questions curated by our experts. These Kubernetes Interview Questions and Answers will help you transition to a top DevOps job role. We have covered conceptual questions for freshers and experts and will help you answer different questions like the difference between config map and secret, monitoring, ways to test a manifest, automatic load balancing, rolling updates, self-healing, and horizontal scaling. With these Kubernetes Interview Questions with detailed answers as your resource, you can be confident that you will be well-prepared for your next interview. Prepare well and crack your interview with ease and confidence! Get well prepared with these interview questions and answers for Kubernetes.

Recommended Courses

Learners Enrolled For
CTA
Got more questions? We've got answers.
Book Your Free Counselling Session Today.