Pivotal Container Service (PKS) deploys and manages the Kubernetes components of a cluster through BOSH. BOSH manages them these clusters through jobs.
In Kubernetes, you adjust the default Kubernetes log level for a component by updating the "--v=X
" flag.
On a Kubernetes Worker node in PKS, you adjust the default log level for a
component by simply updating the *_ctl
file of the Kubernetes component with the Kubernetes log setting you want. Then restart the Kubernetes component.
The Kubernetes component will then log with the appropriate log level you set until you change it back, or the Kubernetes cluster is upgraded or the Master node is redeployed.
Note: The manual changes should not be expected to remain during these related events. This is by design.
ssh
to the Worker node you are troubleshooting.## If you are logged in to pks api. Example: pks login -a <pks-api-address> -u <user> -k2. Then use BOSH to
ssh
to the Kubernetes Worker node of the service-instance for the Kubernetes cluster:
export clusteruuid=$(pks cluster clustername --json | jq -r .uuid) bosh -d service-instance_${clusteruuid} ssh worker/0 sudo -i3. Follow the below steps to change the log level of the Kubernetes worker component, kubelet.
cd /var/vcap/jobs/kubelet/bin
sed -n '/kubelet \\/p' kubelet_ctl ##Return: kubelet \
*_ctl
file and make a copy of this file. For example: sed -i.backup 's/kubelet \\/kubelet --v=9 \\/' kubelet_ctl
monit restart kubelet
cp /var/vcap/jobs/kubelet/bin/kubelet_ctl.backup /var/vcap/jobs/kubelet/bin/kubelet_ctl monit restart kubelet4. Follow the below steps to change the log level of the Kubernetes worker component, kube-proxy.
cd /var/vcap/jobs/kube-proxy/bin
sed -n '/kube-proxy \\/p' kube_proxy_ctl ##Return: kube-proxy \
*_ctl
file and make a copy of this file. For example: ##Setting log level 9 for V logs: sed -i.backup 's/kube-proxy \\/kube-proxy --v=9 \\/' kube_proxy_ctl
monit restart kube-proxy
cp /var/vcap/jobs/kube-proxy/bin/kube_proxy_ctl.backup /var/vcap/jobs/kube-proxy/bin/kube_proxy_ctl monit restart kube-proxy