在k8s中看到了一些源码: // delete immediately, or no graceful deletion supported klog.V(6).Infof("going to delete %s from registry: ", name) if _, _, err := e.Delete(ctx, accessor.GetName(), deleteValidation, options); err != nil && !apierrors.IsNotFound(err) { klog.V(4).Infof("Delete %s in DeleteCollection failed: %v", accessor.GetName(), err) errs <- err return }我想我可以通过查看这些日志kubectl logs,但我看不到它们,即使使用kubectl logs --v 6 <kubeapi server pod> | grep "going to delete"或者kubectl logs --v 4 <kubeapi server pod> | grep "DeleteCollection" 我仍然看不到应该由 klog 输出的日志。我如何查看这些日志?
1 回答
FFIVE
TA贡献1797条经验 获得超6个赞
答案是:将 --v=4 arg 添加到 kube api 服务器配置文件以启用日志详细信息。
文件路径:/etc/kubernetes/manifests/kube-apiserver.yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 192.168.49.2:8443
creationTimestamp: null
labels:
component: kube-apiserver
tier: control-plane
name: kube-apiserver
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
- --advertise-address=192.168.49.2
- --allow-privileged=true
- --v=4
.......
然后 kubectl 日志 --v=4
- 1 回答
- 0 关注
- 213 浏览
添加回答
举报
0/150
提交
取消