k8s通过yaml创建pod_k8s 创建 pod 问题,小白提问

使用 YAML 配置创建的 nginx Pod 能正常运行,但当尝试用相同配置运行一个基于 CentOS 的镜像时,容器进入 CrashLoopBackOff 状态,无日志输出。Kubernetes 描述显示容器启动失败,可能的原因包括 nfs 挂载问题、yaml 语法错误或容器内部启动脚本错误。目前 kubelet 提示可能缺少 ClusterDNS 配置。
摘要由CSDN通过智能技术生成

个人需求是将 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值