1 | initial version |
To alter the log level of a Kubernetes pod, follow these steps:
Open your terminal and connect to your Kubernetes cluster using kubectl.
Run the command kubectl get pods
to list all the running pods in the cluster.
Choose the pod for which you want to alter the log level.
Issue the command kubectl logs <pod-name>
to check the level of logs for the pod.
To change the log level, edit the pod’s YAML file with the following changes:
containers:
- name: <container-name>
env:
- name: LOG_LEVEL
value: <desired-log-level>
Replace <container-name>
with the name of the container in the pod.
Replace <desired-log-level>
with the desired log level (e.g. DEBUG, INFO, WARNING, ERROR etc.).
Save the edited YAML file.
Issue the command kubectl apply -f <edited-YAML-file>
to apply the changes to the pod.
Verify the changes by issuing the command kubectl logs <pod-name>
again.