前言

当k8s启动容器时,如果配置文件有误,会出现"Back-off restarting failed container"的报错信息

更正配置

形如1

... ...
    spec:
      containers:
	  # 添加如下两行内容
        imagePullPolicy: IfNotPresent	  
        command: [ "/bin/sh", "-c", "--" ]
        args: [ "shile true; do sleep 30; done;" ]	  
... ...

形如2

... ...
    spec:
      containers:
	  # 添加如下两行内容
        imagePullPolicy: IfNotPresent	  
        command: [ "/bin/bash", "-ce", "tail -f /dev/null" ]
... ...

形如3

... ...
    spec:
      containers:
	  # 添加如下两行内容
        imagePullPolicy: IfNotPresent	  
        restartPolicy: Never
	    command:
	      - /bin/sh
	      - "-c"
	      - "sleep 60m"
... ...
结语

… …

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐