DevOps 2021: Kubernetes Cheatsheet for beginners

DevOps 2021: Kubernetes Cheatsheet for beginners

Kubernetes also known as K8s, is an open source container orchestrator. An orchestrator is a platform which helps in management, configuration, and deployment of containerised applications.

We can group together hosts running Linux containers and Kubernetes can effortlessly manage those clusters. Kubernetes automates essentially every process right from deployment, management and scaling of containerised applications.

Kubernetes was developed by Google. Google plays a big role in pioneering the Linux container technology. The main advantage of Kubernetes is that it provides a platform to optimize the clusters.

Things you can do with Kubernetes

* Container orchestration
* Automating the whole process hence reduces the error and time.
* Easy management of containers.
* Ideal for optimizing application for cloud based applications.

Now we have pretty much understood what and why is Kubernetes used. Now, let’s look at some of the commonly used terminology in Kubernetes.

Control Plane: Consider it as the starting point of all the assignments and tasks. It is essentially a group of processes that monitors the Kubernetes nodes.
Nodes:  Node is also a machine which performs the tasks given by the control plane.
Pod: It is a group of containers which uses a single node. It is similar to how group of computers share the same network by group of computers. The machines connected to the same pod have the same IP address, hostname.
Kubelet: This is a service which runs on nodes. It takes care of the fact that containers are up and running.
Kubectl: This is a command line interface (CLI) configuration tool for Kubernetes. It communicates through Kubernetes API server. Kubectl facilitates to create, inspect, update, and delete Kubernetes objects.

Here we have a list of Kubernetes commands which comes in handy for any beginner. We have categorized the commands according to the components of Kubernetes architecture.

Cluster Management

kubectl version                                                                       This command is used to display the current version running on the client and server.

kubectl config view                                                              This command is used to display the configuration of the cluster.

kubectl api-resources                                                         This command is used to display the list of the available API resources.

kubectl cluster-info                                                             This command provides the information about the master and services in the cluster.

Deployments

kubectl get deployment                                                     This command is used to get the information about all the deployments.

kubectl describe deployment  <deployment_name>    This command provides the detailed state of deployment.

kubectl edit deployment  <deployment_name>             This command is used to edit and update the definition of one or more deployment on the server.

kubectl create deployment <deployment_name>         This command is used to create a new deployment.

kubectl delete deployment <deployment_name>          This command is used to delete deployments

Nodes

kubectl get node                                                                            This command is used to get the list of one or more nodes.

kubectl delete node <node_name>                                         This command is used to get delete nodes.

kubectl  top node                                                                              This command is used to get usage by CPU/Storage for nodes.

Kubectl get pods –o wide| grep <node_name>                 This command is used to get a list of pods running on a node.

Pods

kubectl get pod                                                                       This command is used to list one or more pods.

kubectl delete pod <pod_name>                                    This command is used to delete a pod.

kubectl describe pod <pod_name>                               This command is used to display the detailed state of pods.

kubectl create pod <pod_name>                                    This command is used to create a pod.

kubectl top pod                                                                       This command is used to get the usage by CPU/storage for pods.

kubectl label pod <pod_name>                                       This command is used to add or update the label of pod.

Replication Controllers

kubectl  get rc                                                                          This command is used to get the list of replication controllers.

kubectl get rc –namespace=”<namespace_name>”     This command is used to get the list of replication controllers by namespace.

Service Accounts

kubectl get serviceaccounts                                                  This command is used to display the detailed state of one or more service accounts
kubectl delete serviceaccount <service_account_name>    This command is used to delete a service account.

Logs

kubectl logs <pod_name>                                                  This command is used to get the logs for a pod.

kubectl logs –since=1h <pod_name>                            This command is used to get the logs for the last hour for a pod

kubectl logs –tail=20 <pod_name>                               This command is used to get the most recent 20 lines of logs

kubectl logs -f <pod_name>                                              This command is used to print the logs for a pod and follow new logs

kubectl logs -c <container_name> <pod_name>     This command is used to print the logs for a container in a pod

kubectl logs <pod_name> pod.log                                  This command is used to get the output of the logs for a pod into a file named ‘pod.log’

kubectl logs –previous <pod_name>                            This command is used to view the logs for a previously failed pod.

kubetail <pod_prefix> -s 5m                                            This command is used to include the most recent 5 minutes of logs

Events

kubectl get events                                                                  This command is used to list recent events for all resources in the system

kubectl get events –field-selector type=Warning     This command is used to list Warnings only

kubectl get events –field-selector involvedObject.kind!=Pod      This command is used to list events but exclude Pod events

Manifest Files

kubectl apply -f manifest_file.yaml                                This command is used to apply a configuration to an object by filename.

kubectl create -f manifest_file.yaml                                This command is used to create objects.

kubectl create -f ./dir                                                            This command is used to create objects in all manifest files in a directory.

kubectl create -f ‘url’                                                             This command is used to create objects from a URL.

kubectl delete -f manifest_file.yaml                               This command is used to delete an object.

 

So in case you are a beginner and trying to learn Kubernetes, these kubectl or (kube-kutl) as we call them will definitely come handy for you during your initial phases. We will also share our next series of Kubernetes cheatsheet for intermediate & advanced level of users.

CATEGORIES
TAGS
Share This

COMMENTS

Wordpress (0)
Disqus (0 )
gujarat xnxx orangeporn.info youtubesexvidoes shradha kapoor hot indiansexbar.mobi choti behan ko mom2fuck hindipornblog.com malayalam sexy videos bad masti indian doodhwali.net xnxx school sex hentai rei ayanami adulthentai.net hentai shion
indian pornographic actress oopsmovs.info tamilgirlsnude bangali sexi girl 3porn.info xxx17 backpag bangalore youjizz.sex hindi sex vedio indian ooo sex xxxindianporn.org south indian actress pussy sex video of nepal pornozavr.net 16honey.com
telangana village sex ipornmovs.mobi naked girls sex indian super sex noticieroporno.com heavy r .com sex video lokal cumporn.info telugu andhra sex videos kamasutra porn movie tubepatrol.cc eenadu karnataka xxlxcom borwap.pro rachana narayanankutty