DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Roy
Roy

Posted on

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

Top comments (0)

Now it's your turn.

ย 
๐Ÿ—’ Share a tutorial
๐Ÿค” Reflect on your coding journey
โ“ Ask a question
ย 
Create an account to join hundreds of thousands of DEV members on their journey.