What is Kubernetes and why it is important?
Kubernetes is the container orchestration tool. The container is used to package the application to run it in any system and this container's functionality is managed by Kubernetes.
Some advantages are:-
Hosts containerized workloads, providing them with computing, storage, and network resources.
Automatically manages large numbers of containerized applications keeping them healthy and available by adapting to changes and challenges.
What is the difference between docker swarm and Kubernetes?
Docker Swarm is simple to set up and run. You can be off and running with creating services in moments. To manage a swarm, you use the same Docker command line interface you use to build images and run containers on your workstation. This makes for a greater degree of approachability for Docker users.
Kubernetes uses a different command line interface. It has many similarities to the Docker interface, but it’s a separate executable with more commands to know. Kubernetes also has a vast array of configuration and authentication options. This gives much greater flexibility—but at the cost of having much more you need to know.
How does Kubernetes handle network communication between containers?
Components in a Kubernetes platform include nodes, applications, containers, and pods. These components communicate using different networking methods. The methods areas are shown below:-
Internet-to-service networking - Using the internet directly is critical. So, Ingress and egress techniques help to set up external access. These two policies are set up with either blacklisting or whitelisting to control traffic in and out of a network.
Container-to-container networking - It is straightforward for containers situated in the same pod to communicate with each other.
Pod-to-pod networking - Pods in Kubernetes are allocated a unique IP address which they use to communicate with each other.
Pod-to-service networking - Containers can go down at any moment, which may lead to the loss of all data stored in them. Same way, pods have IP addresses that may disappear unexpectedly. When this happens, Kubernetes replaces the lost IP addresses with new ones. So, each pod gets allocated a single IP address. An abstraction layer set on top of pods solves this problem. It helps communicate with the pods and eliminates the need to track pods as they start, die, and get rescheduled without affecting the application. Kubernetes services handle the abstraction layer. These services assign a single IP address to each set of pods. This enables the routing of traffic addressed to a pod through the virtual IP address of the service.
How does Kubernetes handle the scaling of applications?
Kubernetes uses Replicas to maintain the accountability of running Pods and ensures a fixed amount of Pods running each time. Even if due to some issues a Pod goes down, it automatically comes up. Based on CPU utilization K8s provides scalability to maintain application stability.
What is a Kubernetes Deployment and how does it differ from a ReplicaSet?
Kubernetes deployment is the methodology to rolling the updates of an application without making the services down. Deployment files have a set of features that define the application configurations and which include the replicas. ReplicaSets provides a set of replicas for the running Pods and on top of this additional configurations combine to form K8s deployment.
Can you explain the concept of rolling updates in Kubernetes?
The rolling update is the feature in K8s that allows the users to update the application without causing downtime. Rolling updates allow the following actions:
Promote an application from one environment to another (via container image updates)
Rollback to previous versions.
Continuous Integration and Continuous Delivery of applications with zero downtime
How does Kubernetes handle network security and access control?
Kubernetes uses the RBAC(RollBackAccessControl) method and a set of network policies to handle its network and access controls. Network Policies are defined to limit the traffic of external networks incoming to specific clusters. Access control policies restrict the access of unwanted users and allow only users with specific permissions.
Can you give an example of how Kubernetes can be used to deploy a highly available application?
Kubernetes uses Replicas in the Kubernetes configuration file which is responsible for making a fixed number of Pod available at all times. Let's say a Pod goes down to some issue then the application would become unstable and could go down. Here we define the replicas which contain the number of Pods that need to be available all time.
Kubernetes Uses Load balancer that distributes incoming traffic between the Pods which makes the application highly available.
Kubernetes uses network Policies that make prevents application vulnerability.
What is a namespace is Kubernetes? Which namespace any pod takes if we don't specify any namespace?
Namespace is the methodology of categorizing a single cluster into multiple sub-clusters in an organisation. These sub-clusters are then managed by different teams that can interact and share information between them. While the clusters can function autonomously, they are still connected to other clusters and aren’t completely independent, and can even support one cluster nested within another. In general, there is a default namespace where all the resources exist.
How does ingress help in Kubernetes?
Ingress defines a set of rules that allows the inbound connection of the external world to access Kubernetes cluster services. An ingress controller needs to be installed.
When the external Ip hits, the Ingress controller routes to Kubernetes endpoints.
Explain different types of services in Kubernetes.
NodePorts, ClusterIP and load-balancers are different ways to get external traffic into a Kubernetes cluster.
A ClusterIP service is the default type of service in Kubernetes. It creates a service inside the Kubernetes cluster, which can be accessed by other applications in the cluster, without allowing external access.
A NodePort service opens a specific port on all the Nodes in the cluster, and any traffic sent to that port is forwarded to the service. The service cannot be accessed from the cluster IP.
LoadBalancer is the most commonly used service type for Kubernetes networking. It is a standard load balancer service that runs on each pod and establishes a connection to the outside world, either to networks like the Internet or within your data centre.
Can you explain the concept of self-healing in Kubernetes and give examples of how it works?
There are two ways of self-healing in K8s.
The first way is to use Replicas that ensure the availability of the Pods required to maintain the stability of the application.
The second one is the use of scalability with which the number of Pods is increased or decreased according to the application demand which ensures the Load stability on the application at all times.
How does Kubernetes handle storage management for containers?
Kubernetes uses Persistent Volumes to keep the data intact in the containers. Kubernetes persistent volumes are administrator-provided volumes. They have predefined properties including file system, size, and identifiers like volume ID and name.
For a Pod to start using these volumes, it must request a volume by issuing a persistent volume claim (PVC). PVCs describe the storage capacity and characteristics a pod requires, and the cluster attempts to match the request and provision the desired persistent volume.
How does the NodePort service work?
To allow external traffic into a Kubernetes cluster, you need a NodePort ServiceType. When Kubernetes creates a NodePort service, Kube-Proxy allocates a port in the range 30000-32767 and opens this port on the interface of every node (the Node port). Connections to this port are then forwarded to the service’s cluster IP.
What are a multinode cluster and a single-node cluster in Kubernetes?
A single-node cluster is a basic infrastructure platform. Everything that needs to be executed is deployed to the current Kubernetes cluster.
Multinode Kubernetes clusters make up a Kubernetes multi-cluster environment. They can be set up in various ways – within the confines of a single physical host, with a variety of hosts in the same data centre, or using the same cloud provider in multiple geographies.
Difference between creating and applying in Kubernetes?
When Create is provided as input, K8s then creates a file according to the defined configuration files.
While Apply in K8s is used to make the changes in the already existing Kubernetes application Pods, Services, deployments, etc.
Thanks for reading my article. Have a nice day.
WRITTEN BY Biswaraj Sahoo --AWS Community Builder | DevOps Engineer | Docker | Linux | Jenkins | AWS | Git | Terraform | Docker | kubernetes
Empowering communities via open source and education. Connect with me over linktree: linktr.ee/biswaraj333