WEBVTT

00:00.206 --> 00:04.619
-Okay, let us now walk through this lab
to go a little bit more

00:05.238 --> 00:10.024
in detail on network inside, 
especially on weave.

00:10.690 --> 00:11.572
Let's get started.

00:11.790 --> 00:15.050
How many nodes are part of this cluster
including the master and worker nodes?

00:15.509 --> 00:17.934
Okay, let me first set an alias,

00:20.474 --> 00:26.001
and then let's do a get nodes.
We see that there are two nodes.

00:26.425 --> 00:29.903
This two is the correct answer here.

00:33.225 --> 00:36.206
Now, what is the networking
solution used by this cluster?

00:36.702 --> 00:42.440
We know that we could do that by first
looking at the process, the kubelet.

00:43.832 --> 00:46.643
We'll do a ps aux

00:47.490 --> 00:49.926
and grep for kubelet.

00:50.966 --> 00:55.159
We see that the network plugin is cni.
We know that it's cni.

00:56.424 --> 01:00.792
Now, we're going to look at the cni plugin

01:00.840 --> 01:01.385
and

01:02.376 --> 01:06.936
we look at the configuration section 
for cni under /etc/cni.

01:06.941 --> 01:09.015
We see that it's weave.

01:09.020 --> 01:11.990
Weave is the networking solution
that's used in this lab.

01:13.948 --> 01:15.088
Let's select weave.

01:16.142 --> 01:19.982
How many weave agents/peers
are deployed in this cluster?

01:19.986 --> 01:21.550
Let's do that.

01:21.557 --> 01:27.051
Now, from what we know, we know that
on every node, there will be an agent.

01:27.881 --> 01:30.970
There are two node 
so we should have two agents.

01:31.384 --> 01:34.940
We also know that we can see that,

01:34.948 --> 01:38.694
for sure, by looking at

01:40.781 --> 01:41.891
the past this year.

01:41.897 --> 01:47.934
We see that there are two weave net pods 
and these are the agents.

01:47.940 --> 01:49.357
The answer is two.

01:53.289 --> 01:55.542
Now, on which nodes 
are the weave peers present?

01:56.998 --> 01:59.746
Let's do -o wide on the same command

01:59.755 --> 02:03.571
to see the nodes that 
these pods are present.

02:07.444 --> 02:08.745
Let's do that for a better view.

02:09.010 --> 02:15.219
We see that there are two pods and
they are on a controlplane and node01.

02:17.996 --> 02:19.431
One worker nodes only.

02:20.019 --> 02:23.886
One on every node.
One on every node is the answer here.

02:25.371 --> 02:27.760
Now, identify the name 
of the bridge network/interface

02:27.760 --> 02:29.832
created by weave on each part.

02:29.837 --> 02:33.115
If you do a ip link,

02:33.476 --> 02:35.977
we see the interfaces are on the node.

02:36.265 --> 02:39.945
We see that we have lots of interfaces 
and one of that is weave.

02:41.369 --> 02:43.353
That's the interface that's created here.

02:43.550 --> 02:47.588
You can also check on the worker node 
which is node01.

02:48.213 --> 02:50.898
Let's do an IP link here.

02:51.324 --> 02:56.117
We also see that there's weave here. 
It's weave. That's the name.

03:00.135 --> 03:03.531
Now, what is the pod IP address
range configured by weave?

03:03.843 --> 03:07.540
We can find that out by looking at 
the logs of the weave pod.

03:07.549 --> 03:13.740
We could just do 
a get pods -n kube-system.

03:17.710 --> 03:20.051
We are on node01 
so let's go back out.

03:23.102 --> 03:30.383
Let's do a pods -n kube-system.

03:31.235 --> 03:35.116
We see that these are the pods.
Let's look at the logs of one of those.

03:35.121 --> 03:36.456
We do a logs

03:38.457 --> 03:43.413
in the kube-system namespace

03:46.216 --> 03:48.207
and let's just copy this.

03:52.358 --> 03:54.261
The container name is weave.

03:56.084 --> 03:58.085
If you look at the beginning of this,

03:58.085 --> 04:00.771
we see that 
there is an IP allocation range,

04:00.776 --> 04:05.353
and that is 10.50.0.0/16.

04:05.894 --> 04:11.369
This is the IP address range 
that's going to be used by weave to assign

04:11.469 --> 04:12.995
to all the pods in the cluster.

04:16.317 --> 04:20.497
Now, what is the default gateway 
configured on the pod scheduled on node01?

04:21.934 --> 04:26.241
Try scheduling a pod on node01
and check IP route output.

04:26.249 --> 04:26.990
Let's do this.

04:26.995 --> 04:30.724
Let's first create a pod
so let's do a dry run.

04:31.153 --> 04:34.909
For stuff like this, 
we should be using the BusyBox image.

04:35.207 --> 04:37.974
Let us do a image=busybox.

04:39.659 --> 04:41.721
When you use BusyBox, 
we want it to stay alive.

04:41.723 --> 04:47.127
We're going to do a sleep 1000.
It stand for 1,000 seconds.

04:47.640 --> 04:50.097
We also want to make sure 
it lands on node01.

04:51.462 --> 04:53.422
Let's do a dry run.

04:57.150 --> 04:59.703
--dry-run=client.

05:01.420 --> 05:03.865
Let's get the output in a YAML format.

05:06.559 --> 05:08.330
Okay.
That was a mistake.

05:09.992 --> 05:12.170
That's an example of 
what you should not be doing.

05:13.578 --> 05:17.805
These options are the options for
the kubectl command,

05:17.929 --> 05:21.395
but because they're put 
after these two dashes,

05:21.643 --> 05:23.448
they went into the sleep command.

05:24.747 --> 05:28.601
Any option for the [?] should be going 
before these two dashes.

05:29.807 --> 05:31.464
That was the wrong way to do it.

05:31.694 --> 05:33.115
Let me delete that

05:35.678 --> 05:38.007
busybox,

05:42.474 --> 05:44.102
pod busybox.

05:45.435 --> 05:49.433
Okay.
I'm just going to do that again.

05:50.481 --> 05:58.195
I'll do a kubectl run
busybox--image=busybox.

06:00.082 --> 06:05.719
Then we're going do a dry-run=client.

06:07.350 --> 06:09.407
I'll put that into a YAML format,

06:09.849 --> 06:15.496
but we'll also have the command 
pass through, which is sleep 1000.

06:16.552 --> 06:18.344
See if that works.
Okay. That's worked.

06:18.764 --> 06:23.760
It's automatically put these
and now we're going to do is--

06:24.137 --> 06:28.289
I'll put that to busybox.yaml.

06:29.475 --> 06:31.285
Let's edit that file.

06:32.104 --> 06:35.785
We're going to add a node name because
we want this to be placed on node01

06:36.073 --> 06:38.626
and we want it to be surely placed 
on node01

06:38.629 --> 06:42.510
so we could add a node name, node01.

06:45.254 --> 06:50.795
Okay. Then let's do 
a kubectl create -f busybox.yaml.

06:52.136 --> 06:53.703
Let's see what happened

06:55.755 --> 06:58.121
and let's see where it placed the node.

07:00.846 --> 07:02.724
It's placed the part on node01,

07:04.118 --> 07:08.553
but now, we've got to go into the pod

07:08.553 --> 07:11.857
and run a command to list 
the routing table.

07:12.369 --> 07:15.920
We're going to do 
a Qkubectl exec busybox,

07:16.661 --> 07:19.777
then what we're going to do is 
we going to do a route -n

07:19.935 --> 07:25.842
or you could do an IP route 
[?] IP route.

07:27.414 --> 07:32.835
Either of these commands will tell us
that the default gateway is 10.50.192.0.

07:33.558 --> 07:35.147
All right?
That's the default gateway.

07:39.023 --> 07:41.794
Okay.
That's the end of this lab.

