Anushka hasini:
Hi, how to kill the containerd container of the kube-proxy Pod on node cluster2-worker1 and write the events into /opt/course/15/container_kill.log
. I have used crictl rm " container name". But it will create new one after delete the existing one. In that case, how can i kill container of the kube-proxy pod and also not sure how to write scripts for the same in order to write events to log file
unnivkn:
Hi @Anushka hasini may I know why you want to delete the system pod?
It is not a good practice to kill the system pods. Since kubeproxy is a system pod & it’s deployed as a daemonset,
It will bring up the new pod the moment you try to kill it. However you may be able to see the events
try this:
kubectl get events -n kube-system kube-proxy > /opt/course/15/container_kill.log
Anushka hasini:
Actually, this is whole tasks. I just try to execute it —> Write a command into /opt/course/15/cluster_events.sh
which shows the latest events in the whole cluster, ordered by time. Use kubectl
for it.
Now kill the kube-proxy Pod running on node cluster2-worker1 and write the events this caused into /opt/course/15/pod_kill.log
.
Finally kill the containerd container of the kube-proxy Pod on node cluster2-worker1 and write the events into /opt/course/15/container_kill.log
.
Do you notice differences in the events both actions caused?
Anushka hasini:
I am unclear about this scenario…It would be really useful if someone try to explain me about it
unnivkn:
Hi @Anushka hasini the question looks like you have to write the cluster events to a file before pod & container kills & after you kills them
Anushka hasini:
Ok…But How can I write into a file if I login to cluster-master, cluster-worker. Because it doesnot allow me to create a file inside the node. I can create only in the terminal
unnivkn:
Through terminal you can ssh to any node & work on it… as a k8s user you may have given access to write files on file system. If this is killer.sh question, they may provide you the solution. please check that.
Haritha G:
@Anushka hasini The scenario is simple, get events after each step you perform. The log doesn’t mean the pod or container logs.
- k get events -A(whole cluster and all the namespaces)
- k get events |grep -kube-proxy > store in the file.
Anushka hasini:
Ok thank you…let me check it