Answer: Kubernetes Pod stuck in CrashLoopBackOff

icy1900

Roy

Posted on September 28, 2021

Answer: Kubernetes Pod stuck in CrashLoopBackOff

I faced similar issue. Just verify if your container is able to run continuously. You have to run the process in foreground to keep container running.

我在试图在 k8s 中运行 ubuntu pod 时,也遇到这个问题,添加 command, 使用 sleep 代替 image 中的缺省设置 bash 就好了

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: ubuntu
  name: ubuntu
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ubuntu
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: ubuntu
    spec:
      containers:
      - image: ubuntu
        name: ubuntu
        command:
          - sleep
        args:
          - infinity
        resources: {}
status: {}
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
icy1900
Roy

Posted on September 28, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related