Interview Questions & Answers Complete Guide for Kubernetes

Table of Contents

Kubernetes


What is Kubernetes? Why organizations are using it?

What is a Kubernetes Cluster?

Kubernetes Nodes


What is a Node?

What the master node is responsible for?

What do we need the worker nodes for?

What is kubectl?

Which command you run to view your nodes?

True or False? Every cluster must have 0 or more master nodes and at least on e worker

What are the components of the master node?

What are the components of a worker node?

Kubernetes Pod


Explain what is a pod

Deploy a pod called “my-pod” using the nginx:alpine image

How many containers can a pod contain?

What does it mean that “pods are ephemeral?

Which command you run to view all pods running on all namespaces?

How to delete a pod?

Kubernetes Deployment


What is a “Deployment” in Kubernetes?

How to create a deployment?

How to edit a deployment?

What happens after you edit a deployment and change the image?

How to delete a deployment?

What happens when you delete a deployment?

How make an app accessible on private or external network?

Kubernetes Service


What is a Service in Kubernetes?

True or False? The lifecycle of Pods and Services isn’t connected so when a pod dies, the service still stays

What Service types are there?

How to get information on a certain service?

How to verify that a certain service forwards the requests to a pod

What is the difference between an external and an internal service?

How to turn the following service into an external one?

spec:
  selector:
    app: some-app
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081

What would you use to route traffic from outside the Kubernetes cluster to services within a cluster?

Kubernetes Ingress


What is Ingress?

Complete the following configuration file to make it Ingress

metadata:
  name: someapp-ingress
spec:
Explain the meaning of "http", "host" and "backend" directives
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: someapp-ingress
spec:
  rules:
  - host: my.host
    http:
      paths:
      - backend:
          serviceName: someapp-internal-service
          servicePort: 8080

What is Ingress Controller?

What are some use cases for using Ingress?

How to list Ingress in your namespace?

What is Ingress Default Backend?

How to configure a default backend?

How to configure TLS with Ingress?

True or False? When configuring Ingress with TLS, the Secret component must be in the same namespace as the Ingress component

Kubernetes Configuration File


Which parts a configuration file has?

What is the format of a configuration file?

How to get latest configuration of a deployment?

Where Kubernetes gets the status data (which is added to the configuration file) from?

Kubernetes etcd


What is etcd?

True or False? Etcd holds the current status of any kubernetes component

True or False? The API server is the only component which communicates directly with etcd

True or False? application data is not stored in etcd

Kubernetes Namespaces


What are namespaces?

Why to use namespaces? What is the problem with using one default namespace?

True or False? When a namespace is deleted all resources in that namespace are not deleted but moved to another default namespace

What special namespaces are there by default when creating a Kubernetes cluster?

What can you find in kube-system namespace?

How to list all namespaces?

What kube-public contains?

How to get the name of the current namespace?

What kube-node-lease contains?

How to create a namespace?

What default namespace contains?

True or False? With namespaces you can limit the resources consumed by the users/teams

How to switch to another namespace? In other words how to change active namespace?

What is Resource Quota?

How to create a Resource Quota?

Which resources are accessible from different namespaces?

Let’s say you have three namespaces: x, y and z. In x namespace you have a ConfigMap referencing service in z namespace. Can you reference the ###ConfigMap in x namespace from y namespace?

Which service and in which namespace the following file is referencing?

apiVersion: v1
kind: ConfigMap
metadata:
  name: some-configmap
data:
  some_url: samurai.jack

Which components can’t be created within a namespace?

How to list all the components that bound to a namespace?

How to create components in a namespace?

Kubernetes Commands


What kubectl exec does?

What kubectl get all does?

What the command kubectl get pod does?

How to see all the components of a certain application?

What kubectl apply -f [file] does?

What the command kubectl api-resources –namespaced=false does?

How to print information on a specific pod?

How to execute the command “ls” in an existing pod?

How to create a service that exposes a deployment?

How to create a pod and a service with one command?

Describe in detail what the following command does kubectl create deployment kubernetes-httpd –image=httpd

Why to create kind deployment, if pods can be launched with replicaset?

How to scale a deployment to 8 replicas?

How to get list of resources which are not in a namespace?

How to delete all pods whose status is not “Running”?

What kubectl logs [pod-name] command does?

What kubectl describe pod [pod name] does? command does?

How to display the resources usages of pods?

What kubectl get componentstatus does?

What is Minikube?

How do you monitor your Kubernetes?

You suspect one of the pods is having issues, what do you do?

What the Kubernetes Scheduler does?

What happens to running pods if if you stop Kubelet on the worker nodes?

What happens what pods are using too much memory? (more than its limit)

Describe how roll-back works

True or False? Memory is a compressible resource, meaning that when a container reach the memory limit, it will keep running

What is the control loop? How it works?

Kubernetes Operator


What is an Operator?

Why do we need Operators?

What components the Operator consists of?

How Operator works?

True or False? Kubernetes Operator used for stateful applications

What is the Operator Framework?

What components the Operator Framework consists of?

Describe in detail what is the Operator Lifecycle Manager

What openshift-operator-lifecycle-manager namespace includes?

What is kubconfig? What do you use it for?

Can you use a Deployment for stateful applications?

Explain StatefulSet


Kubernetes ReplicaSet

What is the purpose of ReplicaSet?

How a ReplicaSet works?

What happens when a replica dies?

Kubernetes Secrets

Explain Kubernetes Secrets

How to create a Secret from a key and value?

How to create a Secret from a file?

What type: Opaque in a secret file means? What other types are there?

True or False? storing data in a Secret component makes it automatically secured

What is the problem with the following Secret file:

apiVersion: v1   
kind: Secret
metadata:
    name: some-secret
type: Opaque
data:
    password: mySecretPassword
How to create a Secret from a configuration file?
What the following in Deployment configuration file means?
spec:
  containers:
    - name: USER_PASSWORD
      valueFrom:
        secretKeyRef:
          name: some-secret
          key: password

Kubernetes Storage

True or False? Kubernetes provides data persistence out of the box, so when you restart a pod, data is saved

Explain “Persistent Volumes”. Why do we need it?

True or False? Persistent Volume must be available to all nodes because the pod can restart on any of them

What types of persistent volumes are there?

What is PersistentVolumeClaim?

True or False? Kubernetes manages data persistence

Explain Storage Classes

Explain “Dynamic Provisioning” and “Static Provisioning”

Explain Access Modes

What is Reclaim Policy?

What reclaim policies are there?

Kubernetes Access Control


What is RBAC?

Explain the Role and RoleBinding” objects

What is the difference between Role and ClusterRole objects?

Kubernetes Misc


Explain what Kubernetes Service Discovery means

You have one Kubernetes cluster and multiple teams that would like to use it. You would like to limit the resources each team consumes in the ###cluster. Which Kubernetes concept would you use for that?

What Kube Proxy does?

What “Resources Quotas” are used for and how?

Explain ConfigMap

How to use ConfigMaps?

Trur or False? Sensitive data, like credentials, should be stored in a ConfigMap

Explain “Horizontal Pod Autoscaler”

When you delete a pod, is it deleted instantly? (a moment after running the command)

How to delete a pod instantly?

Explain Liveness probe

Explain Readiness probe

What does being cloud-native mean?

Explain the pet and cattle approach of infrastructure with respect to kubernetes

Describe how you one proceeds to run a containerised web app in K8s, which should be reachable from a public URL.

How would you troubleshoot your cluster if some applications are not reachable any more?

Describe what CustomResourceDefinitions there are in the Kubernetes world? What they can be used for?

How does scheduling work in kubernetes?

How are labels and selectors used?

Explain what is CronJob and what is it used for

What QoS classes are there?

Explain Labels. What are they and why would one use them?

Explain Selectors

What is Kubeconfig?

Helm


What is Helm?

Why do we need Helm? What would be the use case for using it?

Explain “Helm Charts”

It is said that Helm is also Templating Engine. What does it mean?

What are some use cases for using Helm template file?

Explain the Helm Chart Directory Structure

How do you search for charts?

Is it possible to override values in values.yaml file when installing a chart?

How Helm supports release management?

Submariner

Explain what is Submariner and what is it used for

What each of the following components does?:

Lighthouse

Broker

Gateway Engine

Route Agent

Istio

Rajesh Kumar
Follow me