본문 바로가기

CKA &. CKAD/Networking

Practice Test - Explore Kubernetes Environments

ㅁ How many nodes are part of this cluster?

kubectl get nodes

 

ㅁ What is the network interface configured for cluster connectivity on the master node?

notde-to-node communication

 

$ cat /etc/network/interfaces

 

[ens3]

 

Hint

- Run the ip link command and identify the interface

ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:42:ac:11:00:0a brd ff:ff:ff:ff:ff:ff
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    link/ether 02:42:83:9b:3e:a7 brd ff:ff:ff:ff:ff:ff
4: cni0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether d6:94:9a:b4:b5:7f brd ff:ff:ff:ff:ff:ff
5: veth14d0a2e1@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cni0 state UP mode DEFAULT group default 
    link/ether 96:80:8d:95:15:bb brd ff:ff:ff:ff:ff:ff link-netnsid 0
6: veth9a784a77@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cni0 state UP mode DEFAULT group default 
    link/ether f6:6e:d6:b6:aa:46 brd ff:ff:ff:ff:ff:ff link-netnsid 1

 

kubectl get node -o wide
NAME           STATUS   ROLES    AGE    VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION       CONTAINER-RUNTIME
controlplane   Ready    master   134m   v1.18.0   172.17.0.10   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13
node01         Ready    <none>   134m   v1.18.0   172.17.0.13   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13

 

ifconfig 
cni0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.244.0.1  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::d494:9aff:feb4:b57f  prefixlen 64  scopeid 0x20<link>
        ether d6:94:9a:b4:b5:7f  txqueuelen 1000  (Ethernet)
        RX packets 37633  bytes 2557478 (2.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 40685  bytes 15416646 (15.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.255.0  broadcast 172.18.0.255
        ether 02:42:83:9b:3e:a7  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.10  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:acff:fe11:a  prefixlen 64  scopeid 0x20<link>
        ether 02:42:ac:11:00:0a  txqueuelen 1000  (Ethernet)
        RX packets 100404  bytes 49668856 (49.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 82740  bytes 61139734 (61.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1377144  bytes 283660577 (283.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1377144  bytes 283660577 (283.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth14d0a2e1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::9480:8dff:fe95:15bb  prefixlen 64  scopeid 0x20<link>
        ether 96:80:8d:95:15:bb  txqueuelen 0  (Ethernet)
        RX packets 18837  bytes 1543699 (1.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20378  bytes 7713928 (7.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth9a784a77: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::f46e:d6ff:feb6:aa46  prefixlen 64  scopeid 0x20<link>
        ether f6:6e:d6:b6:aa:46  txqueuelen 0  (Ethernet)
        RX packets 18796  bytes 1540641 (1.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20357  bytes 7706222 (7.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

ㅁ What is the IP address assigned to the master node on this interface? 

kubectl get node -o wide
NAME           STATUS   ROLES    AGE    VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION       CONTAINER-RUNTIME
controlplane   Ready    master   142m   v1.18.0   172.17.0.10   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13
node01         Ready    <none>   141m   v1.18.0   172.17.0.13   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13

 

ㅁ What is the MAC address of the interface on the master node?

ifconfig -v ens3
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.10  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:acff:fe11:a  prefixlen 64  scopeid 0x20<link>
        ether 02:42:ac:11:00:0a  txqueuelen 1000  (Ethernet)
        RX packets 100404  bytes 49668856 (49.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 82740  bytes 61139734 (61.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

 

ip link show ens3
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:42:ac:11:00:0a brd ff:ff:ff:ff:ff:ff

 

ㅁ What is the IP Address assing to node01?

kubectl get node -o wide
NAME           STATUS   ROLES    AGE    VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION       CONTAINER-RUNTIME
controlplane   Ready    master   142m   v1.18.0   172.17.0.10   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13
node01         Ready    <none>   141m   v1.18.0   172.17.0.13   <none>        Ubuntu 18.04.5 LTS   4.15.0-122-generic   docker://19.3.13

 

ㅁ What is the MAC adderss assigned to node01?

arp 를 통해 확인

arp node01
Address                  HWtype  HWaddress           Flags Mask            Iface
node01                   ether   02:42:ac:11:00:0d   C                     ens3

 

ssh node01에서 실제 확인

 

ssh node01 ip link show ens3
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:42:ac:11:00:0d brd ff:ff:ff:ff:ff:ff

 

ㅁ We use Docker as our container runtime. What is the interface/bridge created by Docker on this hosts?

 

Run the command ip link and look for a bridge interface created by docker

ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 02:42:ac:11:00:0a brd ff:ff:ff:ff:ff:ff
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    link/ether 02:42:83:9b:3e:a7 brd ff:ff:ff:ff:ff:ff
4: cni0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether d6:94:9a:b4:b5:7f brd ff:ff:ff:ff:ff:ff
5: veth14d0a2e1@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cni0 state UP mode DEFAULT group default 
    link/ether 96:80:8d:95:15:bb brd ff:ff:ff:ff:ff:ff link-netnsid 0
6: veth9a784a77@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master cni0 state UP mode DEFAULT group default 
    link/ether f6:6e:d6:b6:aa:46 brd ff:ff:ff:ff:ff:ff link-netnsid 1

[docker0]

 

ㅁ What is the state of the interface docker0

[Down]

[UNKNOWN]

[UP]

 

ip link show docker0

$ ip link show docker0

3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    link/ether 02:42:83:9b:3e:a7 brd ff:ff:ff:ff:ff:ff

 

ㅁ If you were to ping google from the master node, which route does it take?

What is the IP addressof the Default Gateway?

 

전체 route 확인

$ ip r

default route 확인

$ ip route show default

default via 172.17.0.1 dev ens3 

 

ㅁ What is the port the kube-scheduler is listening on in the master node?

$ netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      2573/kubelet        
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      3127/kube-proxy     
tcp        0      0 172.17.0.10:2379        0.0.0.0:*               LISTEN      2229/etcd           
tcp        0      0 127.0.0.1:2379          0.0.0.0:*               LISTEN      2229/etcd           
tcp        0      0 172.17.0.10:2380        0.0.0.0:*               LISTEN      2229/etcd           
tcp        0      0 127.0.0.1:38765         0.0.0.0:*               LISTEN      2573/kubelet        
tcp        0      0 127.0.0.1:2381          0.0.0.0:*               LISTEN      2229/etcd           
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      319/rpcbind         
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      24444/./app_kuberne 
tcp        0      0 127.0.0.1:10257         0.0.0.0:*               LISTEN      2211/kube-controlle 
tcp        0      0 127.0.0.1:10259         0.0.0.0:*               LISTEN      2118/kube-scheduler 
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      569/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      775/sshd            
tcp6       0      0 :::8888                 :::*                    LISTEN      24422/kubectl       
tcp6       0      0 :::10250                :::*                    LISTEN      2573/kubelet        
tcp6       0      0 :::10251                :::*                    LISTEN      2118/kube-scheduler 
tcp6       0      0 :::6443                 :::*                    LISTEN      2202/kube-apiserver 
tcp6       0      0 :::10252                :::*                    LISTEN      2211/kube-controlle 
tcp6       0      0 :::111                  :::*                    LISTEN      319/rpcbind         
tcp6       0      0 :::10256                :::*                    LISTEN      3127/kube-proxy     
tcp6       0      0 :::22                   :::*                    LISTEN      775/sshd 

ㅁ Notice that ETCD is listening on two pars. Which of these have more client connections established?

 

[2380]

[6443]

[2379]

$ netstat -anp | grep etcd | grep 2379 | wc -l

74
$ netstat -anp | grep etcd | grep 2380 | wc -l

1

'CKA &. CKAD > Networking' 카테고리의 다른 글

CNI in Kubernetes  (0) 2021.03.31
Pod Networking  (0) 2021.03.31
Cluster Networking  (0) 2021.03.30
CNI (Container Network Interface)  (0) 2021.03.30
Docker Networking  (0) 2021.03.30