Kubernetes: Dummy Pod

So we can test kubectl┬álet’s create a dummy pod.

kind: Pod
apiVersion: v1
metadata:
  name: w-dummy-pod
spec:
  containers:
    - name: w-dummy-pod
      image: ubuntu
      command: ["/bin/bash", "-ec", "while :; do echo '.'; sleep 5 ; done"]
  restartPolicy: Never

Apply with:

kubectl apply -f pod.yaml

and test with:

kubectl get pods

 

I get:

k get pods
NAME          READY   STATUS    RESTARTS   AGE
w-dummy-pod   0/1     Pending   0          3m

 

The logs won’t show anything ‘cos it hasn’t started yet.

Let’s describe the pod.

k describe pod w-dummy-pod

Events:
  Type     Reason            Age                   From               Message
  ----     ------            ----                  ----               -------
  Warning  FailedScheduling  40s (x26 over 6m57s)  default-scheduler  0/1 nodes are available: 1 NodeUnderMemoryPressure.

Memory pressure.

Let’s give minikube more memory.

minikube config set memory 2048

then

k get pods
NAME          READY   STATUS    RESTARTS   AGE
w-dummy-pod   1/1     Running   0          41s

and we can exec in with:

k exec -it w-dummy-pod bash

 

Let’s check we can cp a file in:

echo "test" > test.txt

Prove it doesn’t exist in the Pod by:

k exec -it w-dummy-pod bash

and ls

Then:

k cp test.txt w-dummy-pod:/testing.txt

and then exec in and ls.

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *