WEBVTT

00:00.860 --> 00:03.990
Hello and welcome to this lecture in this lecture.

00:04.010 --> 00:11.640
We will now look at Command and Arguments in a Kubernetes POD. In the previous lecture we created a simple

00:11.670 --> 00:15.480
Docker image that sleeps for a given number of seconds.

00:15.540 --> 00:24.200
We named it ubuntu-sleeper and we ran it using the docker command docker run ubuntu-sleeper. By default

00:24.260 --> 00:30.690
It sleeps for five seconds but you can override it by passing a command line argument.

00:30.770 --> 00:34.160
We will now create a pod using this image.

00:34.160 --> 00:37.060
We start with a blank pod definition template,

00:37.250 --> 00:40.580
input the name of the pod and specify the image name.

00:40.580 --> 00:46.820
When the pod is created, it creates a container from the specified image, and the container sleeps for

00:46.820 --> 00:49.760
five seconds before exiting.

00:49.770 --> 00:56.300
Now if you need the container to sleep for 10 seconds as in the second command how do you specify the

00:56.300 --> 01:00.000
additional argument in the pod definition file.

01:00.350 --> 01:07.460
Anything that is appended to the docker run command will go into the “args” property of the pod definition

01:07.460 --> 01:11.180
file in the form of an array like this.

01:11.240 --> 01:15.400
Let us try to relate that to the docker file we created earlier.

01:15.620 --> 01:23.000
The Dockerfile has an Entrypoint as well as a CMD instruction specified. The entrypoint is the

01:23.000 --> 01:30.680
command that is run at startup, and the CMD is the default parameter passed to the command. With the args

01:30.740 --> 01:33.200
option in the pod definition file

01:33.200 --> 01:36.870
we override the CMD instruction in the Dockerfile.

01:37.130 --> 01:44.690
But what if you need to override the entrypoint? Say from sleep to a hypothetical sleep2.0 command? In

01:44.690 --> 01:45.880
the docker world.

01:45.950 --> 01:52.640
We would run the docker run command with the entry point option set to the new command the corresponding

01:52.700 --> 02:00.320
entry in the pod definition file would be using a command field the command field corresponds to entry

02:00.320 --> 02:08.720
point instruction in the docker file so to summarize there are two fields that correspond to two instructions

02:08.780 --> 02:10.070
in the docker file.

02:10.340 --> 02:17.480
The command field overrides the entry point instruction and the args field overrides the command instruction

02:17.480 --> 02:18.890
in the docker file.

02:18.890 --> 02:26.370
Remember it is not the command field that overrides the CMD instruction in the docker file.

02:26.530 --> 02:32.260
Well that's it about commands and arguments in Kubernetes head over to the coding exercises section

02:32.620 --> 02:38.590
and practice viewing configuring and troubleshooting commands and arguments in kubernetes.

