๐˜’๐˜ถ๐˜ฃ๐˜ฆ๐˜ณ๐˜ฏ๐˜ฆ๐˜ต๐˜ฆ๐˜ด ๐˜›๐˜ณ๐˜ฐ๐˜ถ๐˜ฃ๐˜ญ๐˜ฆ๐˜ด๐˜ฉ๐˜ฐ๐˜ฐ๐˜ต๐˜ช๐˜ฏ๐˜จ <-> ๐˜œ๐˜ด๐˜ฆ๐˜ง๐˜ถ๐˜ญ ๐˜ค๐˜ฐ๐˜ฎ๐˜ฎ๐˜ข๐˜ฏ๐˜ฅ๐˜ด

by Ismail.EL
0 comment

I introduce you in this article a set of very useful commands in the Kubernetes world, everyone use a K8s must know them

To start with anything on command line: To understand the meaning of yaml files use

To see the logs of a container

Container logs are automatically rotated daily and every time the log file reaches 10MB in size. The kubectl logs command only shows the log entries from the last rotation.

Know more about your kubectl and cluster

generic commands

Creating any object in kubernetes

modifying an object

Get the service acccounts

K8s api server details

get deployment reated info

Rollback

Rollback -> First look at the revision names of the deployments:

Rollback -> Pick a version from the past and rollback

Get info about other objects

secrets

Role

Pods

Entering into a container running inside a pod :

labels

Investigating the logs:

Controller Deployment

pod logs kubectl logs pod/

To get more columns in the result use -L

To get more all the pods that have label creation_method:manual

To list all pods that include the env label, whatever its value is:

namespaces

When you want to figure out why the previous container terminated, youโ€™ll want to see those logs instead of the current containerโ€™s logs. This can be done by using the –previous option:

Instead of using the kubectl scale command, youโ€™re going to scale it in a declarative way by editing the ReplicationControllerโ€™s definition:

When deploying a pod, you donโ€™t need to constantly poll the list of pods by repeatedly executing kubectl get pods. Instead, you can use the –watch flag and be notified of each creation, modification, or deletion of a pod,

Both the Control Plane components and the Kubelet emit events to the API server as they perform these actions. They do this by creating Event resources, which are like any other Kubernetes resource.

Remove the taints on the master so that you can schedule pods on master as well.

Run Kubectl with better logging to see what kubectl is doing.

Conclusion

In this post, i have learned a usefull command in kubernetes field, these command will help you to manage and debug your cluster easily, if you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it ๐Ÿ™‚

23010cookie-check๐˜’๐˜ถ๐˜ฃ๐˜ฆ๐˜ณ๐˜ฏ๐˜ฆ๐˜ต๐˜ฆ๐˜ด ๐˜›๐˜ณ๐˜ฐ๐˜ถ๐˜ฃ๐˜ญ๐˜ฆ๐˜ด๐˜ฉ๐˜ฐ๐˜ฐ๐˜ต๐˜ช๐˜ฏ๐˜จ <-> ๐˜œ๐˜ด๐˜ฆ๐˜ง๐˜ถ๐˜ญ ๐˜ค๐˜ฐ๐˜ฎ๐˜ฎ๐˜ข๐˜ฏ๐˜ฅ๐˜ด

Related Posts

Leave a Comment