WEBVTT

00:00.960 --> 00:02.060
-In this solution video,

00:02.230 --> 00:04.520
we will explore the network configuration

00:04.690 --> 00:06.210
for our Kubernetes cluster.

00:07.810 --> 00:08.970
For the first question,

00:09.140 --> 00:11.130
we have to identify the number
of nodes part

00:11.300 --> 00:13.660
of the cluster including master
and worker.

00:14.550 --> 00:17.950
Let's run the command kubectl get nodes.

00:18.640 --> 00:22.000
Here we can see
that we have two nodes in total.

00:26.890 --> 00:28.590
What is the network interface configured

00:28.750 --> 00:30.900
for cluster connectivity
on the master node?

00:31.130 --> 00:34.030
This is what is used
for our node-to-node communication.

00:35.380 --> 00:41.340
For this, let's go back to the terminal
and we'll run ifconfig -a,

00:41.590 --> 00:44.120
which will show
all the network interfaces used.

00:46.290 --> 00:49.170
This will show you all the interfaces
including the loopback,

00:49.340 --> 00:53.230
the actual physical interface used
by the cluster, et cetera.

00:53.400 --> 00:55.380
There's another way to do this in Ubuntu.

00:55.550 --> 01:01.090
Let's run cat /etc/network/interfaces file
which will open up this file

01:01.260 --> 01:03.490
and show us the physical interface used.

01:03.970 --> 01:07.990
Here we can see
that besides the loopback interface,

01:08.160 --> 01:12.920
the other physical interface available
to the system is called ens3.

01:14.830 --> 01:16.760
Let's select that as our answer.

01:18.690 --> 01:21.230
Before we do that, we can also run IP link

01:21.630 --> 01:25.010
to show all the physical links
on this system.

01:25.170 --> 01:26.880
Here you can see ens3.

01:27.970 --> 01:30.110
Let's select that as our answer.

01:34.040 --> 01:37.380
What is the IP address assigned
to the master node on this interface?

01:37.540 --> 01:40.180
For this, we can go back
to our ifconfig command.

01:40.350 --> 01:43.040
We can run ifconfig

01:44.300 --> 01:47.110
and instead of dash here,
we can just specify the interface here.

01:47.280 --> 01:52.010
Here we have the IP,
which is 172.17.0.4.

01:56.380 --> 01:59.500
What is the MAC address
of the interface on the master node?

01:59.920 --> 02:01.810
Again, we can make use
of the exact same command.

02:01.970 --> 02:04.030
it is available in ifconfig.

02:05.580 --> 02:10.640
As you can see for the field called ether,
there is the MAC address.

02:11.290 --> 02:14.030
We can also use IP link command.

02:16.510 --> 02:20.580
Type IP link and look up
the hardware address assigned to ens3,

02:20.740 --> 02:24.020
which starts with 02 and ends with 04.

02:24.180 --> 02:26.200
Let's select that as our answer,

02:26.830 --> 02:28.630
which is our option number one here.

02:29.620 --> 02:31.750
What is the IP address assigned to node01?

02:31.920 --> 02:36.460
We do the exact same process,
but we'll run it on node01.

02:36.630 --> 02:43.540
For that we'll run ssh node01,
followed by ifconfig ens3.

02:45.190 --> 02:50.420
This will fetch the output

02:50.590 --> 02:52.200
of the command ifconfig ens3

02:52.360 --> 02:53.450
and print it on the screen.

02:53.620 --> 02:55.240
We are already on the master server.

02:55.410 --> 02:57.720
This will just ssh to node01.

02:58.640 --> 03:01.990
Run that command and it will display
the result on our terminal.

03:02.160 --> 03:06.050
Here we have the IP address
of ens3 on node01,

03:06.510 --> 03:09.480
which is 172.17.0.7.

03:17.230 --> 03:19.260
What is the MAC address assigned
to the nodes01?

03:19.430 --> 03:21.240
Let's use the same command

03:21.400 --> 03:25.100
and we have the MAC address
in the same command as well.

03:25.270 --> 03:26.690
It ends with 07.

03:27.800 --> 03:30.300
Let's select that as our answer.

03:31.930 --> 03:33.840
We use Docker as our container runtime,

03:34.000 --> 03:39.060
what is the interface or bridge
created by Docker on this host?

03:41.510 --> 03:43.450
Let's run ifconfig -a again

03:43.610 --> 03:47.260
and that will list
all the different interfaces

03:47.420 --> 03:52.160
including the Docker bridge,
which in this case is named docker0.

04:00.820 --> 04:02.580
What is the state
of the interface docker0?

04:02.740 --> 04:04.930
Let's run IP link.

04:05.360 --> 04:07.910
It will not be available
in the ifconfig command.

04:08.660 --> 04:12.070
Let us run IP link for docker0.

04:17.580 --> 04:23.050
Here, if you look up the status
of docker0 interface, it is set to down.

04:27.390 --> 04:29.790
If we were to ping Google
from the master node,

04:29.950 --> 04:31.500
which route does it take?

04:31.660 --> 04:33.910
What is the IP address
of the default gateway?

04:35.630 --> 04:38.100
This can be found out
using a single command

04:38.710 --> 04:41.670
called IP route or IP r.

04:42.380 --> 04:45.400
What we have to do is look up
the default route,

04:45.570 --> 04:47.670
which in this case is the very first line.

04:48.370 --> 04:50.790
The default route goes
through the default gateway

04:50.960 --> 04:53.830
which is 172.17.0.1

04:53.990 --> 04:56.920
for our physical interface, ens3.

04:57.550 --> 04:59.160
We'll select that as the answer.

05:00.430 --> 05:04.770
What is the port the kube-scheduler
is listening on in the master node?

05:05.590 --> 05:07.830
There are multiple ways we can do that,

05:07.990 --> 05:11.050
we can look up at the configuration
of our kube-scheduler,

05:11.220 --> 05:12.510
which is a static port.

05:12.940 --> 05:15.850
There's another way
to look at the live port

05:16.010 --> 05:18.960
which the kube-scheduler is listening on.

05:19.420 --> 05:21.180
For that, we'll use netstat

05:21.890 --> 05:23.980
and we'll use these additional flags,

05:24.140 --> 05:29.690
natulp, p for process,
grep for kube-scheduler.

05:31.770 --> 05:37.120
This will print the process used
by kube-scheduler along with the ports

05:37.290 --> 05:38.450
that it's listening on.

05:38.610 --> 05:42.640
In this, we can see
that in the very bottom of the screen

05:43.270 --> 05:48.280
of the output,
the port that is used is 10251,

05:48.450 --> 05:51.410
which is used for my kube-scheduler.

05:53.310 --> 05:54.820
Look for the listen session

05:55.360 --> 05:59.300
and here the port
that is being used is 10251.

05:59.940 --> 06:01.380
That's our answer.

06:06.670 --> 06:08.960
Notice that ETCD
is listening on two ports,

06:09.130 --> 06:11.840
which of these have
more client connections established?

06:12.000 --> 06:15.270
Let's run the same command as before,
which is netstat.

06:15.670 --> 06:18.580
This time, we will search for ETCD instead

06:19.010 --> 06:20.570
and we'll look
at the different connections

06:20.740 --> 06:23.670
on different ports used
by the ETCD port.

06:28.920 --> 06:33.340
Here we can see
four different listen sessions.

06:33.510 --> 06:38.500
If you observe closely,
2379 is used the most.

06:38.990 --> 06:41.330
We also have 2380

06:42.070 --> 06:44.100
and there is also another port, 2381,

06:44.260 --> 06:46.410
which is also used by ETCD,

06:46.570 --> 06:49.900
but the one that is used most is 2379.

06:52.360 --> 06:55.170
That's because 2379 is the port of ETCD

06:55.330 --> 06:57.720
to which all control plane
components connect.

06:57.930 --> 07:00.610
2380 is used
for peer-to-peer connectivity.

07:00.780 --> 07:03.190
In this case, we do not have
additional master nodes,

07:03.360 --> 07:08.210
so we don't have multiple sessions
for that specific port.

07:08.700 --> 07:09.870
That was the last question.

07:10.030 --> 07:11.990
Thank you for joining me in this video.

07:12.320 --> 07:13.770
I'll see you in the next one.

