Wednesday, August 21, 2024

Kubernetes Introduction [Part-1]







Health checkup of the Kubernetes cluster 

Dumped a kubernetes cluster configuration

#kubectl cluster-info dump

Simple diagnostic of kubernetes cluster
#kubectl get componentstatuses


We can get more information about specific node through describe command.

Changed the default namespace in a two ways:

    * Edit the $HOME/.kube/config and change it 
   *  kubectl config set-context my-context --namespace=mynamespace
 * kubectl config use-context my-context

List pod details along with namespaces:

#kubectl get pods --all-namespaces


Find a worker node information:

#kubectl get node nodename



Apply the yaml file into kubernetes:

#kubectl apply -f name.yaml

The apply tool will only modify the objects that are different from the current objects in the cluster. If the objects you are creating already exist in the cluster means it will simply exit successfully without making any changes.  If you want to see what the apply command will do without actually making any changes. We can run a --dry-run flag to printout the objects which is going to change into terminal.

#kubectl edit resource objectname

We can edit a file through command line without change into local file.

Apply command also record the previous configuration within object.

#kubectl apply -f name.yaml view-last-applied










No comments:

Post a Comment