This page looks best with JavaScript enabled

CrashLoopbackOff error in Kubernetes in Raspberry Pi CM4

 ·  ☕ 2 min read  ·  🐧 sysadmin
  1. Here is a video tutorial; continue reading for a list of written instructions.

Exercises to complete:

  1. Create pods with Alpine and Ubuntu images.
  2. Use the watch command to watch the changes live.
  3. Check the architecture of machine Kubernetes runs on.
  4. Use multiarch image.
  5. Get into the container.
  6. Create a pod with Ubuntu image through yaml file with sleep command.
  7. Apply the YAML file.
  8. Observe changes.
  9. Set the Kubernetes policy.
Create pods with Alpine and Ubuntu images
1
2
kubectl run alpine --image=alpine
kubectl run ubuntu --image=ubuntu
Use the watch command to watch the changes live.
1
watch kubetcl get pods
Check the architecture of machine Kubernetes runs on
1
2
uname -a
uname -m
Use multiarch image
1
kubectl run multiarch --image=nginx:alpine
Get into the container
1
2
kubectl exec --help
kubectl exec -it multiarch -- /bin/ash

or

1
kubectl exec -it multiarch -- /bin/ash
Create a pod with Ubuntu image through yaml file with sleep command
1
vim pod.yaml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
apiVersion: v1
kind: Pod
metadata:
  name: ubuntu-sleep
  namespace: default
spec:
  containers:
    - name: ubuntu
      image: ubuntu
      command:
        - sleep
        - "60"
      resources:
        limits:
          memory: "600Mi"
        requests:
          memory: "100Mi"

Apply the YAML file.

1
kubectl apply -f pod.yaml
Use the watch command to watch the changes live.
1
watch kubetcl get pods

You will observe that pod with container are restarting. This is not a solution.

Set the Kubernetes policy
1
2
kubectl run ubuntu-no-restart --image=ubuntu --restart=Never
kubectl run ubuntu-on-failure --image=ubuntu --restart=OnFailure

By default Kubernetes policy restarts always the pod.

Use the watch command to watch the changes live.
1
watch kubetcl get pods

Pods have status completed, but there are no running containers inside pods.

Support the author with

sysadmin
WRITTEN BY
sysadmin
QA & Linux Specialist