个人需求是将 nfs 挂在到容器中使用,通过 yaml 配置的创建的 nginx pod 可以正常运行,于是将 nginx 的配置文件镜像改成了 centos,然后在运行的时候发生了 CrashLoopBackOff 状态,没有 logs 打印,yaml 配置如下
[[email protected] kubermange]# cat 002.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: ct7
spec:
replicas: 2
selector:
app: web01
template:
metadata:
name: nginx
labels:
app: web01
spec:
containers:
- name: ct
image: docker.io/centos
ports:
- containerPort: 22
volumeMounts:
- mountPath: /mnt
readOnly: false
name: nginx-data
volumes:
- name: nginx-data
nfs:
server: 10.10.8.53
path: "/opt/xxx"
kubectl describe 看到的错误如下,还望各位大佬指导下哪里的问题,对 yaml 语法还不太了解,不清楚是不是语法有问题
Events:
FirstSeenLastSeenCountFrom SubObjectPath Type Reason Message
24m 24m 1{default-scheduler } Normal ScheduledSuccessfully assigned ct7-vq8q6 to k8s-node-2
24m 24m 1{kubelet k8s-node-2}spec.containers{ct}Normal Created Created container with docker id c2581b96d5e3; Security:[seccomp=unconfined]
24m 24m 1{kubelet k8s-node-2}spec.containers{ct}Normal Created Created container with docker id ac9f487f2e06; Security:[seccomp=unconfined]
24m 24m 1{kubelet k8s-node-2}spec.containers{ct}Normal Started Started container with docker id c2581b96d5e3
24m 24m 1{kubelet k8s-node-2}spec.containers{ct}Normal Started Started container with docker id ac9f487f2e06
24m 24m 2{kubelet k8s-node-2} Warning FailedSyncError syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 10s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
24m24m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id a9a076866052
24m24m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id a9a076866052; Security:[seccomp=unconfined]
24m23m2{kubelet k8s-node-2} WarningFailedSyncError syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 20s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
23m23m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id aca4a35df4a0
23m23m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id aca4a35df4a0; Security:[seccomp=unconfined]
23m23m4{kubelet k8s-node-2} WarningFailedSyncError syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 40s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
22m22m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id 9ce5a4115e00; Security:[seccomp=unconfined]
22m22m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id 9ce5a4115e00
22m21m6{kubelet k8s-node-2} WarningFailedSyncError syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 1m20s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
21m21m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id c195cd3416e8; Security:[seccomp=unconfined]
21m21m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id c195cd3416e8
21m18m12{kubelet k8s-node-2} WarningFailedSyncError syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 2m40s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
18m18m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id 419f4cc8d420; Security:[seccomp=unconfined]
18m18m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id 419f4cc8d420
13m13m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id d121a921ab20; Security:[seccomp=unconfined]
13m13m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id d121a921ab20
8m8m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated Created container with docker id 7c5cc98fda79; Security:[seccomp=unconfined]
8m8m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted Started container with docker id 7c5cc98fda79
24m3m10{kubelet k8s-node-2}spec.containers{ct}NormalPulling pulling image "docker.io/centos"
3m3m1{kubelet k8s-node-2}spec.containers{ct}NormalStarted (events with common reason combined)
3m3m1{kubelet k8s-node-2}spec.containers{ct}NormalCreated (events with common reason combined)
24m3m11{kubelet k8s-node-2} WarningMissingClusterDNSkubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
24m3m10{kubelet k8s-node-2}spec.containers{ct}NormalPulled Successfully pulled image "docker.io/centos"
18m6s87{kubelet k8s-node-2} WarningFailedSync Error syncing pod, skipping: failed to "StartContainer" for "ct" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=ct pod=ct7-vq8q6_default(4eb85b50-3e05-11e8-a882-0050568a4944)"
24m6s113{kubelet k8s-node-2}spec.containers{ct}WarningBackOffBack-off restarting failed docker container