How To Enable Debug Log for Kube-APIserver on an Existing Cluster
Problem
How to enable debug logs on an existing Cluster.
Environment
- Platform9 Managed Kubernetes (PMK) - All Versions
Procedure
The default Kube-APIserver container debug value is 2. This can be modified using the steps outlined on the master node part of the cluster.
The steps highlighted below are to be done directly on the master nodes that are part of the cluster and thus post cluster upgrade they will be wiped out.
If there is a need to persist the flag values post-cluster upgrade on existing clusters, please contact Platform9 Support.
- Backup the original master.yaml file (PMK's default configuration file retrieved from the default template "
/opt/pf9/pf9-kube/conf/masterconfig/base/centos/master.yaml
") to some other location on the node.
# cp /etc/pf9/kube.d/pod-manifests/master.yaml /root/
- Check default value for the Kube-APIserver container on k8s-master-<master-IP> pod. Using "
kubectl describe pod k8s-master-<Matser-IP>
" command. Here, by default the value is 2
# kubectl describe po k8s-master-<master-IP> -n kube-system
Name: k8s-master-<master-IP>
Namespace: kube-system
Node: <Node-IP>
..
Containers:
kube-apiserver:
Command:
--v=2
3. Now edit debug level for Kube-APIserver container in "/etc/pf9/kube.d/pod- manifests/master.yaml
" file. Pod will get recreated as soon as you save the edited file.
apiVersion: v1
kind: Pod
metadata:
name: k8s-master
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
- --v=8 <----- Edit Debug level value e.g here we changed it from 2 to 8
- Now, verify the change on Kube-API server container on k8s-master-<master-IP> pod using Kubectl describe command.
# kubectl describe po k8s-master-<master-IP> -n kube-system
Name: k8s-master-<master-IP>
Namespace: kube-system
Node: <Node-IP>
..
Containers:
kube-apiserver:
Command:
--v=8 <--------------New debug level should start reflecting
- Once you are done with the troubleshooting, please revert the debug level to 2 as higher debug level will capture many logs and utilise the pod resources.
Was this page helpful?