1
00:00:00,860 --> 00:00:03,990
Hello and welcome to this lecture in this lecture.

2
00:00:04,010 --> 00:00:11,640
We will now look at Command and Arguments in a Kubernetes POD. In the previous lecture we created a simple

3
00:00:11,670 --> 00:00:15,480
Docker image that sleeps for a given number of seconds.

4
00:00:15,540 --> 00:00:24,200
We named it ubuntu-sleeper and we ran it using the docker command docker run ubuntu-sleeper. By default

5
00:00:24,260 --> 00:00:30,690
It sleeps for five seconds but you can override it by passing a command line argument.

6
00:00:30,770 --> 00:00:34,160
We will now create a pod using this image.

7
00:00:34,160 --> 00:00:37,060
We start with a blank pod definition template,

8
00:00:37,250 --> 00:00:40,580
input the name of the pod and specify the image name.

9
00:00:40,580 --> 00:00:46,820
When the pod is created, it creates a container from the specified image, and the container sleeps for

10
00:00:46,820 --> 00:00:49,760
five seconds before exiting.

11
00:00:49,770 --> 00:00:56,300
Now if you need the container to sleep for 10 seconds as in the second command how do you specify the

12
00:00:56,300 --> 00:01:00,000
additional argument in the pod definition file.

13
00:01:00,350 --> 00:01:07,460
Anything that is appended to the docker run command will go into the “args” property of the pod definition

14
00:01:07,460 --> 00:01:11,180
file in the form of an array like this.

15
00:01:11,240 --> 00:01:15,400
Let us try to relate that to the docker file we created earlier.

16
00:01:15,620 --> 00:01:23,000
The Dockerfile has an Entrypoint as well as a CMD instruction specified. The entrypoint is the

17
00:01:23,000 --> 00:01:30,680
command that is run at startup, and the CMD is the default parameter passed to the command. With the args

18
00:01:30,740 --> 00:01:33,200
option in the pod definition file

19
00:01:33,200 --> 00:01:36,870
we override the CMD instruction in the Dockerfile.

20
00:01:37,130 --> 00:01:44,690
But what if you need to override the entrypoint? Say from sleep to a hypothetical sleep2.0 command? In

21
00:01:44,690 --> 00:01:45,880
the docker world.

22
00:01:45,950 --> 00:01:52,640
We would run the docker run command with the entry point option set to the new command the corresponding

23
00:01:52,700 --> 00:02:00,320
entry in the pod definition file would be using a command field the command field corresponds to entry

24
00:02:00,320 --> 00:02:08,720
point instruction in the docker file so to summarize there are two fields that correspond to two instructions

25
00:02:08,780 --> 00:02:10,070
in the docker file.

26
00:02:10,340 --> 00:02:17,480
The command field overrides the entry point instruction and the args field overrides the command instruction

27
00:02:17,480 --> 00:02:18,890
in the docker file.

28
00:02:18,890 --> 00:02:26,370
Remember it is not the command field that overrides the CMD instruction in the docker file.

29
00:02:26,530 --> 00:02:32,260
Well that's it about commands and arguments in Kubernetes head over to the coding exercises section

30
00:02:32,620 --> 00:02:38,590
and practice viewing configuring and troubleshooting commands and arguments in kubernetes.
