So we can test kubectl
let’s create a dummy pod.
1 2 3 4 5 6 7 8 9 10 |
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:
1 2 3 |
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
1 2 3 4 |
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
1 2 3 |
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
.