Showing posts with label Interview questions. Show all posts
Showing posts with label Interview questions. Show all posts

Wednesday, April 5, 2023

Top 42 Kubernetes Interview Questions and Answers with Tips



Kubernetes and the Cloud-Native Ecosystem Interview Questions

Question 1: Where can a container run?

  1. on an LXD system with Docker installed
  2. on a Linux machine with no other prerequisites
  3. on a Windows machine with a container engine installed(correct answer)
  4. on a cloud-based Docker Hub deployment

Kubernetes tip: A container requires an engine (container engine) installed on any operating system on which it is expected to work.

Question 2: One goal of cloud-native technologies is to increase the speed of application deployments.

True(correct anwer)

False

Kubernetes tip: Other goals include making applications highly available, scalable, and portable across environments.


Question 3: What assumption is at the foundation of cloud-native technology?

  1. Software should be released in slow cycles to enable proper testing.
  2. Cloud-native projects should provide isolated solutions with less cross-integration.
  3. It is good to remove silos between ops teams and software development teams. (correct)
  4. Bonus: By removing these silos, cloud technology can help expedite code pushes to production.

Question 4: Which statement is true regarding Kubernetes?

  1. It is written in Java or C++.
  2. It originates in a Facebook system called Go.
  3. It is an open-source project. (Correct)
  4. Kubernetes Tip: Kubernetes is an open-source system with many active developers. It is maintained by Google.

Question 5: Kubernetes is the Greek word for helmsman of a ship. Why did the creators of the project choose this name?

Answer: 

Kubernetes ranks containers in the order in which they were deployed.

Kubernetes oversees a set of servers and decides where to deploy containerized applications, when to scale up and down the number of application replicas, and what to do when an application or server stops working. (correct answer)

K8S Bonus: 

Kubernetes negotiates with other servers and trades containers when it has run out of space.

Kubernetes moves containers from one cloud provider to another.


Questions about setting up and getting oriented with Kubernetes

Question#6: Which installer type is not offered for Minikube on Windows through the official Minikube site?

  1. .exe download
  2. Windows Package Manager
  3. .zip portable download(correct answer)
  4. Chocolatey


KubeCTL Bonus: A Chocolatey installer type is offered through the official Minikube site. A Windows Package Manager installer type is offered.


Question 7: Which command installs Minikube on macOS using Homebrew?

  1. Homebrew install minikube
  2. sudo install minikube
  3. brew install minikube (correct answer)
  4. brew minikube install

Question 8: Which statement is true regarding Docker installation on Windows?

  1. Docker Desktop for Windows is a free application.
  2. Docker is a requirement to run a Minikube Kubernetes cluster. (correct answer)
  3. Docker Desktop installs the container engine required by Kubernetes.
  4. It does not require a restart.

K8S Bonus:

A Docker Desktop installation requires a machine restart.

Docker Desktop actually requires a paid subscription for commercial use in larger enterprises.


Question 9 Which kubectl command lists the pods from all the namespaces?

kubectl get pods -A (correct answer)

kubectl get pods -N

kubectl get namespaces -P

kubectl list pods -all-namespaces


Question 10: For what purpose will you use Minikube?

  1. Run a Kubernetes cluster on your computer. (correct answer)
  2. Run a Kubernetes cluster on AWS
  3. Interact with a Kubernetes cluster

Question 11: Which shell command can you use on Linux at the end of the Docker installation process to confirm that Docker is properly installed?

  1. docker-ce
  2. docker (correct answer)
  3. lsb-release
  4. docker-compose-plugin


Question 12: Which package is not a prerequisite to install Docker on Linux?

  1. gnupg
  2. keyrings (correct answer)
  3. curl
  4. lsb-release

KubeCTL Bonus: "Keyrings" is not a Linux package for a name of a folder used during installation. The GNUPG(GNU Privacy Guard) package is required to add the Docker GPG key.


Question 13: Which statement is true about Minikube?

  1. It is designed to run production clusters.
  2. It is as secure as a complete Kubernetes installation.
  3. It is free software. (correct answer)

KubeCTL Bonus: Minikube is not designed to run production systems.

Question 13: What is different about Docker installation for macOS compared to Windows?

  1. The Docker engine installation on macOS requires a restart.
  2. The macOS installation process considers the chip family on the machine. (correct answer)
  3. The Docker installation package for macOS is different for Intel and Apple chips.
  4. The macOS Docker engine only has a graphical user interface.
  5. The macOS Docker engine has a different name.

K8S Bonus: The Docker installation on macOS does not require a restart.

Questions about application deployment with Kubernetes

Question 14: Using the DESCRIBE POD command, what will the event log show for a pod running for a long time?

  1. If a pod has been running for a while, Kubernetes will assume it is healthy and not show its events.
  2. The command is not expected to show pod events.
  3. The event log will show all events from the launch.
  4. Old events are less interesting for a pod running for a while.
  5. The event log will show as empty. (correct answer)

Question 15: Which KUBECTL command can you use to list all the pods in a specific namespace?

  1. kubectl apply -f mynamespace
  2. kubectl get pods -n mynamespace (correct answer)
  3. kubectl list pods -n mynamespace
  4. kubectl mynamespace -l deployments

Question 16: What will be the outcome of the following command?

kubectl get pods

  1. All pods in all namespaces will be listed.
  2. All pods in the default namespace will be listed (correct answer)
  3. With no specified namespace, the command will list all the default namespace pod.
  4. The command will cause an error.

Question 17: Pod A runs a web server with an IP address of 172.17.0.3. On pod B on the cluster, running wget 172.17.0.3 results in a refused connection. What is one immediate thing to check?

  1. Pod B is exposing port 80.
  2. Pods A and B are exposing port 3000.
  3. Pod A is exposing port 8080.
  4. Pod A is exposing port 80 (correct answer)

k8s Bonus Tip: Pod A should expose the port that the "wget" command is trying to call (defaulting to 80). Remember that "wget" defaults to port 80 if no port is specified.

Question 18: What is the syntax issue in the following YAML file?

items:

- bananas

- tomatoes

  1. The colon needs to be placed correctly.
  2. The indentation is wrong (correct answer)
  3. Nested items must be indented.
  4. Some lines are missing a colon.

Question 18: Which character or sequence of characters will you use in YAML to represent a sequence?

  1. #
  2. - (correct answer)
  3. ---
  4. :

Question 19: When the -o wide option is added to the kubectl get pods to command, what additional information will show?

  1. IP address (correct answer)
  2. The IP address will show for all listed pods.
  3. port
  4. status

Question 20: Which path in the deployment YAML file specifies the number of instances to run?

  1. spec -> template -> spec -> containers
  2. spec -> instances
  3. metadata -> replicas
  4. spec -> replicas (correct answer)

Question 20: What represents a valid namespace YAML?

---

apiVersion: v1

kind: Namespace  name: mynamespace

---

apiVersion: v1

kind: Namespace

metadata:

  name: mynamespace (correct answer)

---

apiVersion: v1

metadata:

  kind: Namespace

  name: mynamespace

---

apiVersion: v1

metadata:

  name: mynamespace

Question 21: What is the immediate parent of the following line?

  1. - containerPort: 8080
  2. template:
  3. spec:
  4. ports: (correct answer)
  5. containers:

Complex Application Deployment in Kubernetes

Question 22: Your deployment YAML has the following configuration. What should your service YAML include so traffic is directed correctly?

metadata:

  labels:

    app: pod-info

spec:

  selector:

    app: pod-service

spec:

  selector:

    app: pod-info

(correct)

spec:

  selector:

    service: pod-info

Question 22: What is not a type of service that Kubernetes offers?

  1. AddressPool (correct answer)
  2. AddressPool is not a service type that Kubernetes supports.
  3. ClusterIP
  4. LoadBalancer
  5. NodePort

Question 23: "resources" refers to a worker node's available bandwidth and memory.

FALSE (correct)

TRUE

K8s Bonus Tip: "resources" refers to a worker node's available CPU and memory.

Question 24: In a deployment YAML file, what is the immediate parent under which the resource request and limit specifications should be placed?

  1. the template block
  2. the env block
  3. the container block (correct answer)

Since the resources apply to a container, they should be specified under the container's block.

Question 25: What do resources refer to in the context of resource requests and limits to a pod?

  1. available storage space for the pod
  2. available CPU and memory for the cluster
  3. available CPU and memory on the worker node (correct answer)

Question 26: What is the result of the following command?

Minikube delete

  1. Delete all objects added using YAML manifests.
  2. Delete the namespaces.
  3. Delete the entire Minikube Kubernetes cluster. (correct answer)

This command will delete the entire Minikube Kubernetes cluster.

Question 27: How would you delete a Kubernetes deployment created with a YAML manifest called api.yaml?

  1. kubectl destroy -f api.yaml
  2. kubectl delete -f api.yaml (correct answer)
  3. kubectl delete deployment
  4. kubectl delete API

Question 28: If you need someone to access an application deployed in your Kubernetes cluster, you'll set up a Kubernetes _____ Service.

  1. NAT Gateway
  2. ClusterIP
  3. LoadBalancer (correct answer)
  4. NodePort

Kubernetes Architecture Interview Questions

Question 29: What is an instance of Kubernetes called?

  1. a worker node
  2. a cluster (correct answer)
  3. a deployment
  4. a server

Question 30: What component communicates directly with the etcd component?

  1. Scheduler component
  2. The API Server (correct answer)
  3. Only the Kube API Server component can communicate directly with etcd.
  4. The Kubelet

Question 31: Which control plane component stores the data about the state of the cluster?

  1. API Server
  2. etcd (correct answer)
  3. scheduler
  4. controller manager

Question 32: What function does the Kubelet component perform on a worker load?

  1. Create containers using a supported engine.
  2. This function is actually handled by the Container Runtime.
  3. Check that pods and services can communicate.
  4. Check that the containers are healthy. (correct answer)

Question 32: What are the three components of every worker node?

  1. container runtime interface, kubelet, and kube-proxy (correct answer)
  2. kube-apiserver, container runtime interface, and kube-proxy
  3. kubelet, cloud-controller-manager, and kube-proxy
  4. kubelet, kube-scheduler, and kube-proxy

Question 33: The kube-proxy is the only worker node component that communicates with the kube-apiserver.

  1. FALSE (correct answer)
  2. TRUE

Question 34: Dockershim was removed from Kubernetes v1.24 . How did this change impact Kubernetes?

  1. Kubernetes can no longer use the Docker engine to run containers.(correct answer)
  2. Kubernetes can no longer be installed on a Docker server host.
  3. Kubernetes can no longer use Docker images to instantiate containers.

Question 35: Which component pulls the image from the image repository, when you launch a pod with a new container image?

  1. api-server
  2. controller manager
  3. kubelet (correct answer)

Question 36: Which two Kubernetes components bind a pod to a node when the user applies a new deployment?

  1. controller manager and scheduler
  2. kubelet and container-runtime
  3. api-server and kubelet (correct answer)
  4. api-server and etcd

Kubernetes tip: The controller manager is only involved in checking for changes. These two components are involved in starting a container.

Question 37: Which of these is not a component of the Kubernetes Control Plane?

  1. kubelet (correct answer)
  2. etcd
  3. kube-apiserver
  4. cloud-controller-manager

Kubernetes Advanced Topics

Question 38:  What is the best way to run these application pods if you need to run an application that performs a one-time extract, transform, load (ETL) operation that transfers data from a SQL database to a data warehouse. ?

  1. StatefulSet
  2. DaemonSet
  3. Job (correct answer)
  4. Deployment

Kubernetes tip: A Kubernetes Job will spin up a pod, run the container until its task is complete, and terminate it. A Job is best for applications that perform one-time operations, like an ETL.

Question 39: How to set up data storage inside a Kubernetes cluster?

  1. Docker volume
  2. a managed SQL database
  3. persistent volume (correct)

Question 40: Which option will work best to run containers that are agents?

  1. Job
  2. Deployment
  3. DaemonSet (correct)

Kubernetes tip: DaemonSets allow you to run one pod per node, which works well for running pods implementing background processes such as agents.

Question 41: What is the immediate parent under which the securityContext definition should be placed?

  1. the env block
  2. the container name
  3. the metadata section
  4. the container block(correct)

Kubernetes tip: Since the security context is defined per container, it must be placed inside its block.

Question 42: Which service or object is associated with Kubernetes persistent volumes?

  1. Amazon RDS
  2. stateless application
  3. statefulSet (correct)

Kubernetes tip: A statefulSet is an object that lets an updated Kubernetes application communicate with the same volume as the previous pod.

Thursday, February 12, 2015

Network Programming Interview Questions C#.Net


  1. Which namespaces are used for TCP/IP network socket programming in C#.Net? Answer: System.Net and System.Net.Sockets
  2. An object of System.Net.Sockets.TcpListener will be used to listen for incoming connection requests. Answer: True
  3. Once we call the method TcpListener.Start, our TcpListener object starts handling incoming connection requests. Answer: False
  4. Which class is used to represent a callback or delegate method? Answer: AsyncCallback
  5. IAsyncResult.AsyncState contains the original TCPListener object which was passed as parameter to BeginAcceptTCPClient method call. Answer: True

  6. The Windows ____ can stop your code from using network, you better disable it for a while. Answer: Firewall
  7. An object of which class is used to handle client communication? Answer: TcpClient
  8. NetworkStream.BeginRead method will return data in ____ array. Answer: byte
  9. TcpClient.Client represent an object of which type? Answer: Socket
  10. Encoding.ASCII.GetBytes is used to convert text to bytes in order to send it over network. Answer: True
  11. A TCP/IP socket server needs to perform following network operations. Answer: Listen for incoming connections, send data to clients, receive data from clients.
Learn more about Socket and network programming in C# .Net in my Udemy course:
TCP/IP Socket Programming For Coders & Students 





Demo TCP/IP Sockets Read and Write in C#, Free Udemy Course from Naeem Akram on Vimeo.

Thursday, February 19, 2009

Difference between Framework and API(API vs. Framework, Framework vs. API)


Software Framework vs. API

In this article, I will quickly explain what a software framework is, what is an API, and are key differences between an API and a software framework.


Software Framework:

It is a re-usable design for a software system (or subsystem). A software framework may include programs, code libraries, a scripting language, and other software to help develop and glue together the different components of a software project. An API(Application Programming Interface) may expose various framework parts.
dot_net_framework
Microsoft's .Net framework is a very good example of a software framework. It contains compilers, class libraries, an IDE(Visual Studio), and a runtime. Another example is OpenCog: A Software Framework for Integrative Artificial General Intelligence.
Now that you know what a framework is let me tell you what an API is so that you can answer the question Framework vs. API.

API (Application Programming Interface):

It is a set of routines( AKA methods or functions), data structures, object classes, and/or protocols provided by libraries and/or operating system services to support applications' building.
Good examples of API are Microsoft TAPI(Telephony API), MySQL connectivity API, and Google MAPS API.










In Microsoft's .Net Framework, only the Base Class Library or BCL is the API. The framework is a bigger thing. API is a part, and the framework is a whole. Although, API can exist on its own without a framework as well.
Now you know what's the answer to API vs. Framework :)


A friend told me yesterday "I interviewed someone; he had no idea about the difference between Framework and an API." I replied, "Owwww that's dumb." In fact, had no idea about the difference either.
Well, I think this is enough to illustrate the difference between Software Framework and API, or Software Framework vs API.



Another example of a software platform is pictured below, Google's Android Mobile Platform, 


android-system-architecture


You see this platform contains many things, a kernel for low-level tasks, certain libraries for OS-level chores, Dalvik Virtual Machine (an enriched clone of Java Virtual Machine), and the "Application Framework" on the "third story." Any software we write for Android smartphones will reside on the 4th floor, labeled "Applications" here.
Some might search this topic as API vs framework; this blog entry will be equally helpful for those friends as well.