Whether you are applying for your dream job or simply want to learn more about Kubernetes, we have created the complete Kubernetes Q&A to get you started. Throughout this blog, we aim to provide you with the answers to the most common Kubernetes questions. From the basics of what Kubernetes is to how you can run Kubernetes locally, this blog will cover questions for those just starting out with Kubernetes to those that are looking to refresh their knowledge.
What is Kubernetes?
Kubernetes is an open-source system for managing containerized applications. It is the most widely used orchestrator for cloud-native, reliable and scalable distributed systems.
What does K8s mean?
Simply put, K8s is just an abbreviation of Kubernetes. It represents the 10-letter word “Kubernetes”, which has 8-letters situated between the ‘K’ and ‘S’.
We explore more about what K8s means in our blog post by Andy Jeffries here.
What is container orchestration?
Container orchestration automates the deployment, management, scaling, and networking of software running in containers helping to create and manage thousands of containers. Using an orchestrator, users are able to manage the state and scale of their application based on monitoring results and workload requirements. Container orchestration should also be able to self-heal the containers if something goes wrong.
If you are interested in learning more about container orchestration, Saiyam Pathak explores this concept more in our Civo Academy course.
What is the need for container orchestration?
Container orchestration helps with the automation of large containerized applications, which has had a significant impact on how developers deploy applications. Complex applications need container orchestration because it helps with the configuration and scheduling of containers, the provisioning and deployments of containers, resource allocation between containers, and securing interactions between containers.
What are the main components of Kubernetes architecture?
To begin understanding the Kubernetes architecture, we must first outline the components and how they connect. The main components of Kubernetes consist of a control plane, a distributed key-value storage system, and worker nodes:
- The control plane: Consists of the Kube-apiserver, known as the brain of the Kubernetes. This establishes communication between all of the components in the control plane.
- Kube-scheduler: Closely watches the creation of the pods and schedules it with a node.
- *Controller manager: *A set of multiple controllers packed into a single binary to reduce complexity and help control the workloads across clusters.
- Etcd: A key-value database for Kubernetes, which stores all the information related to resources and objects running in the cluster.
- Kube-proxy: Establishes communication between the different clusters by running each node in the cluster and allowing network communication between the pods. This enables pods to communicate internally within and outside the cluster.
- Kubelet: Working as the main communication tool between the control plane and the worker nodes. Kubelet communicates with the Kube-apiserver in the control plane to update the working status of the containers within the pods.
Saiyam Pathak looks into the Kubernetes architecture more in our Civo Academy course, which can be found here.
What tasks are performed by Kubernetes?
Besides container orchestration, Kubernetes can do a variety of tasks such as:
- Expose a container using the DNS name or IP address.
- Assisting in load-balancing by distributing the network traffic.
- Mounting a storage system for your application.
- Storing your secrets and sensitive information such as passwords, oAuth2 tokens, SSH keys, etc.
- Besides managing container state in a cluster, Kubernetes can fit containers into nodes leading to the best use of your resources.
- Creating new containers, removing existing containers, and adopting their resources in the new containers for your deployment.
Why do people use Kubernetes?
Kubernetes has become an essential system for containerized applications allowing a maintained process of running application infrastructures. This has made containers an essential element for packaging your code along with the libraries and dependencies for the smooth running of your application. Containers ensure that there is no application downtime for users. This is possible because of rolling updates, which is the default deployment strategy for Kubernetes.
When you try to update an application, you don’t update all the instances of your application at once. It will result in an application outage where service will not be available between the period when the older version of your instances is down and newer versions are up. In Kubernetes, you don’t destroy all your instances; rather, you take down one older version of an instance at a time and bring up a newer version. This results in a seamless update of your application as the application never goes down during the process.
What is Kubectl?
Kubectl is a command line tool used for running commands against Kubernetes clusters. It is used for deploying applications, viewing logs, managing cluster resources, etc. If you are looking to get started with kubectl, Kunal Kushwaha explores how to install kubectl in our Civo Academy course here. Alternatively, Ian Banks, SRE at Civo, looks into kubectl commands more in our tutorial found here.
What are StatefulSets?
StatefulSets is a Kubernetes object used for stateful applications such as databases, allowing for data to be stored and their state to be tracked. This makes it possible to replicate pods of a stateful application and run multiple replicas of it. A StatefulSet gives an individual identity to each one of the replicas, meaning that they cannot be created or deleted in any random order.
In our Kubernetes Objects course, Saiyam Pathak explores the background of StatefulSets and how they work. Start learning more about this topic here.
How is Kubernetes related to Docker?
While Kubernetes allows you to manage the orchestration of your containerized applications, Docker can help with the creation of containers. Docker helps with the packaging, shipping and distribution of your application along with the dependencies in the form of a container, and Kubernetes helps you manage these Docker containers and orchestrate them from a control plane. However, Docker isn’t the only tool to build containers.
To explore more about how Kubernetes and Docker compare with each other and their advantages, visit our blog post here.
How can you run Kubernetes locally?
There are many ways to run Kubernetes locally, but Minikube is one of them. This is an all-in-one system that helps in creating a single node cluster inside a virtual machine on your PC. Minikube consists of single node architecture, meaning that the same system works as the control plane as well as the worker nodes. Minikube is handy for testing, as it will not demonstrate the features Kubernetes provides for multi-node setups used in production.
Kunal Kushwaha takes you through how to create a local Kubernetes cluster in our Civo Academy course here.
What are the main components of the control plane?
The control plane is the backbone of Kubernetes. It makes up the control plane for a cluster and manages the worker nodes by means of critical operations such as scheduling and monitoring. It is composed of several components such as the Kube-apiserver, etcd, Kube-scheduler, and Kube-controller manager:
- Kube-apiserver: It is responsible for orchestrating all communications within the control plane. In addition, it exposes the Kubernetes API, which users use for managing a cluster and making necessary changes.
- Etcd: A highly available database that stores all information regarding workloads and resources running inside a cluster in a key-value format.
- Kube-scheduler: Responsible for scheduling containers or pods to the right node based on the resource requirements of the containers, the capacity of the worker nodes, and the policies or constraints on them.
- Kube-controller manager: There are different types of controllers which each have separate processes in place. To reduce the complexity, all are compiled into a single binary and run as a single process known as the Kube-controller manager.
What is the difference between a pod and a container?
A container is a standard software unit that packages the code along with its libraries and dependencies. This helps to ensure that the application can run quickly and efficiently. Besides packaging, containers help build, ship, deploy, and scale your application with ease. On the other hand, a pod is a group of containers with shared storage and network resources. A pod is the smallest deployable unit that can be created and managed within the Kubernetes ecosystem. In other words, on Kubernetes, containers run in pods.
How do containers within a pod communicate with each other?
Containers within a pod share the same IP address and port space. As containers in different pods have distinguished IP addresses, they can’t communicate with each other without special configuration. They can therefore communicate with each other with the help of localhost. So, if they want to interact with each other, they can do that by means of IP networking.
Learn more about multi-container pod and localhost from our Civo Academy course here.
Start learning more
You can start learning everything you need to know to get started with Kubernetes through Civo Academy. Or, how about putting your knowledge to the test? Sign up to Civo today to launch your first cluster in under 90 seconds!