Welcome to the Linux Foundation Forum!

Office hours - Mar 14 (LFS242 / LFS258)

Hello,

Today we had a visitor asking for help on creating a Kubernetes Pod definition manifest using the imperative approach.
Eventually we came up with the following command that suited the need of the learner:

kubectl run mypod1 --image=busybox --dry-run=client -o yaml > mypod1.yaml --command -- /bin/sh -c 'sleep infinity'

This imperative command generates a definition manifest for a mypod1 Pod expected to run the sleep infinity command in a busybox container, a manifest that is stored in the mypod1.yaml file.

The following command, is slightly different in syntax, and produces a slightly different definition manifest:

kubectl run mypod2 --image=busybox --dry-run=client -o yaml > mypod2.yaml --command -- sleep infinity

Use kubectl apply -f mypod1.yaml mypod2.yaml to run the pods defined by the two manifests. Use kubectl exec <podname> -c <containername> -it -- sh to exec into the containers and run ps to identify the process with PID 1. Can you spot the difference?

Verify the Central Daylight Time (CDT) at https://time.is/CDT.

Regards,
-Chris

Categories

Upcoming Training