我有一个复制控制器,可以继续启动一个pod,但它永远不会启动。我如何访问复制控制器日志,以便我可以调试它? $ kubectl describe rc
:
Name: jenkins-leader-restored
Namespace: default
Image(s): gcr.io/cloud-solutions-images/jenkins-gcp-leader:master-5ca73a6
Selector: name=jenkins,role=leader
Labels: name=jenkins,role=leader
Replicas: 0 current / 1 desired
Pods Status: 0 Running / 0 Waiting / 0 Succeeded / 0 Failed
No volumes.
Events:
FirstSeen LastSeen Count From SubobjectPath Reason Message
───────── ──────── ───── ──── ───────────── ────── ───────
15m 15m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-xxr93
12m 12m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-1e44w
11m 11m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-y3llu
8m 8m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-wfd70
8m 8m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-8ji09
5m 5m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-p4wbc
4m 4m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-tvreo
1m 1m 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-l6rpy
56s 56s 1 {replication-controller } SuccessfulCreate Created pod: jenkins-leader-restored-4asg5
将自动图像构建与Jenkins,Packer和Kubernetes repo一起使用,实践恢复备份'部分。
答案 0 :(得分:1)
Prashanth B.确定了我的问题的根本原因,即有两个复制控制器使用相同的选择器,同时运行不同的副本值。
Google Compute Instance上的kubelet(运行pod)的日志位置为/var/log/kubelet.log
。看这里会有助于指出吊舱立即被移除。
我的故障排除可能是这样的:
确定该pod未按预期运行:
kubectl get pods
检查复制控制器:
kubectl describe rc
搜索已创建的pod的日志,如上一个命令所示:
grep xxr93 /var/log/kubelet.log
user@gke-stuff-d9adf8e28-node-13cl:~$ grep xxr93 /var/log/kubelet.log
I1203 16:59:09.337110 3366 kubelet.go:2005] SyncLoop (ADD): "jenkins-leader-restored-xxr93_default"
I1203 16:59:09.345356 3366 kubelet.go:2008] SyncLoop (UPDATE): "jenkins-leader-restored-xxr93_default"
I1203 16:59:09.345423 3366 kubelet.go:2011] SyncLoop (REMOVE): "jenkins-leader-restored-xxr93_default"
I1203 16:59:09.345503 3366 kubelet.go:2101] Failed to delete pod "jenkins-leader-restored-xxr93_default", err: pod not found
I1203 16:59:09.483104 3366 manager.go:1707] Need to restart pod infra container for "jenkins-leader-restored-xxr93_default" because it is not found
I1203 16:59:13.695134 3366 kubelet.go:1823] Killing unwanted pod "jenkins-leader-restored-xxr93"
E1203 17:00:47.026865 3366 manager.go:1920] Error running pod "jenkins-leader-restored-xxr93_default" container "jenkins": impossible: cannot find the mounted volumes for pod "jenkins-leader-restored-xxr93_default"