Kubernetes doesn't really intend for users to directly submit and launch pods on the cluster. As we discussed previously, pods are designed to be ephemeral, so are not suitable for running workloads where we want to ensure that execution has completed or where we want to ensure that a process remains up and running.
Here, we will start from first principles, launching pods, before moving on to use a controller to help us manage them. Bear in mind that this is a learning exercise; you shouldn't submit pods in this way if you need them to run reliably:
pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: hello-loop
spec:
containers:
- name: loop
image: alpine
command: ["/bin/sh"]
args:
- -c
- while true; do echo "hello world"; sleep 2s; done
This pod launches an infinite loop that prints hello world every 2 seconds....