Getting Started with Kubernetes

Are you looking for how to start with kubernetes? What are the basics of kubernetes? What containers are and why all are opting for containers? Then this is the right place where you will be getting started with it . In this tutorial you will be learning core concepts of Kubernetes. When I started I was juggling from where to start and how to start then I started gathering information from different places and making one piece . Here I will try to be as simple to make it easier to you. So let’s start with small pieces and build our core.

What is Kubernetes?

Kubernetes is a cluster technology it means that applications are distributed across resource nodes allowing high availability and when you deploy an application it’s a kubernetes job to find and attach that resource to that. You can see your cluster information through the following command.

Kubectl cluster-info

Containers and Pods

It is the technology for next level virtualization. Previously we needed to configure a machine( install Operating system, dependent libraries..) and associate that specific machine to host an application but now with containers, applications are wrapped inside a container with all the dependencies and deployed on hosted containers, but containers are isolated from the outside world so it needs a medium to connect so here comes the concept of pods.

Pods : It is the smallest runnable unit deployed on a cluster. It can be single or multiple pods running in a container. It is Kubernetes job to allocate pods in containers while finding the best suitable place.

kubectl get pods/po

Nodes

Nodes are basically machines allocated to clusters. It can be virtual or physical Machines. Previously they were called minions . all the cluster resources are distributed among its node machines. To see how many nodes are present in a cluster.

kubectl get nodes

Namespace

It is a concept of dividing users into groups. It is used for multi-tenancy. If something happens in one namespace you can just delete it and create a new one with the same configuration manifests/files and it will not affect other namespaces. If you are creating in default namespace then you have to delete manually.

kubectl get namespaces
Kubectl create namespace

Storage Class

It provides the way to describe which storage class they belong to. For example we are using OPenstack as a storage class so we will create it to create volume and claim it through persistent volume claim.

Kubectl get storageclass

Persistent Volumes

These are resources of cluster/clusters that store data in it and it persists beyond the deletion and creation of the pod.

Kubectl get persistentvolume

Persistent Volume claim

It is the claim we create while deploying an application to reserve the volume storage in it . It can be done statically defining through Deployment or dynamically through Statefulsets.

Kubectl get persistentvolumeclaim

Secrets

This the authentication layer provider for sensitive information like passwords, ssh keys or certificates information. It stores sensitive data and can be defined in deployment or statefulset manifest can be accessed easily.

Kubectl get secrets

Deployment

These are requirements that are given to cluster what should be running inside the pod. How many replicas of pods should be there. And how many instances of pods should be running and achieve desired state.

Kubectl get deployments

Statefulsets

Its functionality is similar to deployment but in deployment all replicas use the same volume. In statefulsets all replicas use their own volume.

kubectl get statefulsets/sts

Service

We have deployed our application but don’t know where it is so here comes service to the rescue.Through services we talk with deployments within our cluster . Service defines how to logically access the pod and what will be the policy to access it for example there are four types of services:

ClusterIP: This is the default service type that can be accessed within the cluster.

NodePort: This is the service type that exposes each pod and can be accessed outside of the cluster.

LoadBalancer: It is the service that is exposed through LoadBalancer IP of cloud providers.

ExternalName: This type is not a typical selector. It maps the service to the Domain Name System.

kubectl get services/svc

Ingress

It is not a service type but it can expose the multiple services with the same IP address. You can access your pods through ingress.

[Code] kubectl get ingress.

Conclusion:
Now you have gained basic knowledge to start fiddling with kubernetes and create small application deployment. Through my experience the more you create and destroy things you learn more. Don’t be afraid as the best part of containers are you can delete and create the same deployment within minutes. Explore more documentation from here