2 min read
We can install the kubectl convert plugin to help us convert manifest between different API versions: For example, from an Ingress using the extensions/v1beta1 API version to networking.k8s.io/v1
16/06/2022
Read more...2 min read
Sometimes we all end up writing small one-liners to perform some daily tasks with kubectl, it can come handy to create kubectl plugin to be able to add a command that does precisely that for us. Let's see how to add a custom command to kubectl:
10/06/2022
Read more...3 min read
In the same way we can use git blame to identify who and when has modified a specific line, with kubectl blame we'll be able to do the same to Kubernetes objects
13/05/2022
Read more...3 min read
When we don't have the Pod's resources correctly configured we might face the need of moving a Pod to a different node. Although we could change the nodeSelector or adjust the resources to that it gets scheduled on a different node, it might urge us to fix an issue. To do so we can use kubectl drain
At the end of the day what we want it really is "drain the node of that kind of Pods". As kind of by product the node ends up being cordoned so we are sure the Pod won't be scheduled again on the same node.
25/10/2021
Read more...2 min read
If we need to investigate why a container keeps restarting, a good place to start is taking a look at the logs when it crashes. Since Kubernetes will automatically restart a failed container, if we use kubectl logs we will get the logs of the restarted container instead of the one that have crashed:
$ kubectl logs ampa-7d98c84675-dpzjw -c ampa
[2021-10-15 14:20:41 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2021-10-15 14:20:41 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2021-10-15 14:20:41 +0000] [1] [INFO] Using worker: sync
[2021-10-15 14:20:41 +0000] [8] [INFO] Booting worker with pid: 8
How can we retrieve the logs of the previous container?
18/10/2021
Read more...