본문 바로가기
IT 기술/k8s

[cka] Service Networking

by Geunny 2024. 8. 9.
반응형

1. What network range are the nodes in the cluster part of?

 

controlplane ~ ➜  ip a | grep eth0
13520: eth0@if13521: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default 
    inet 192.28.23.6/24 brd 192.28.23.255 scope global eth0

controlplane ~ ➜  ipcalc -b 10.33.39.8
Address:   10.33.39.8           
Netmask:   255.255.255.0 = 24   
Wildcard:  0.0.0.255            
=>
Network:   10.33.39.0/24        
HostMin:   10.33.39.1           
HostMax:   10.33.39.254         
Broadcast: 10.33.39.255         
Hosts/Net: 254                   Class A, Private Internet

 

answer : 192.28.23.0/24

 

 

2. What is the range of IP addresses configured for PODs on this cluster?

 

controlplane ~ ➜  k logs weave-net-dw2xn weave -n kube-system
DEBU: 2024/08/09 13:06:11.534888 [kube-peers] Checking peer "66:e1:15:2b:7e:f1" against list &{[]}
...
INFO: 2024/08/09 13:06:38.777994 added entry 10.244.0.0/17 to weaver-no-masq-local of 0
INFO: 2024/08/09 13:06:38.778796 adding entry 10.244.128.0/18 to weaver-no-masq-local of 0
INFO: 2024/08/09 13:06:38.779731 deleted entry 10.244.0.0/16 from weaver-no-masq-local of 0

 

answer : 10.244.0.0/16

 

3. What is the IP Range configured for the services within the cluster?

controlplane ~ ➜  cat /etc/kubernetes/manifests/kube-apiserver.yaml   | grep cluster-ip-range
    - --service-cluster-ip-range=10.96.0.0/12

 

answer : 10.96.0.0/12

 

4. How many kube-proxy pods are deployed in this cluster?

controlplane ~ ➜  k get pods -n kube-system
NAME                                   READY   STATUS    RESTARTS      AGE
coredns-768b85b76f-82cxf               1/1     Running   0             44m
coredns-768b85b76f-mnvz8               1/1     Running   0             44m
etcd-controlplane                      1/1     Running   0             44m
kube-apiserver-controlplane            1/1     Running   0             44m
kube-controller-manager-controlplane   1/1     Running   0             44m
kube-proxy-cbbkp                       1/1     Running   0             43m
kube-proxy-q559r                       1/1     Running   0             44m
kube-scheduler-controlplane            1/1     Running   0             44m
weave-net-dw2xn                        2/2     Running   1 (44m ago)   44m
weave-net-lfrzn                        2/2     Running   0             43m

 

answer : 2

 

5. What type of proxy is the kube-proxy configured to use?

controlplane ~ ➜  k logs kube-proxy-cbbkp -n kube-system
I0809 13:06:34.622433       1 server_linux.go:69] "Using iptables proxy"
I0809 13:06:34.639934       1 server.go:1062] "Successfully retrieved node IP(s)" IPs=["192.28.23.9"]
I0809 13:06:34.659526       1 conntrack.go:59] "Setting nf_conntrack_max" nfConntrackMax=1179648
I0809 13:06:34.660925       1 conntrack.go:119] "Set sysctl" entry="net/netfilter/nf_conntrack_tcp_timeout_established" value=86400
I0809 13:06:34.711539       1 server.go:659] "kube-proxy running in dual-stack mode" primary ipFamily="IPv4"
I0809 13:06:34.711609       1 server_linux.go:165] "Using iptables Proxier"
I0809 13:06:34.714048       1 server_linux.go:511] "Detect-local-mode set to ClusterCIDR, but no cluster CIDR for family" ipFamily="IPv6"
I0809 13:06:34.714073       1 server_linux.go:528] "Defaulting to no-op detect-local"
I0809 13:06:34.714093       1 proxier.go:243] "Setting route_localnet=1 to allow node-ports on localhost; to change this either disable iptables.localhostNodePorts (--iptables-localhost-nodeports) or set nodePortAddresses (--nodeport-addresses) to filter loopback addresses"
I0809 13:06:34.732947       1 server.go:872] "Version info" version="v1.30.0"
I0809 13:06:34.732986       1 server.go:874] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
I0809 13:06:34.734807       1 config.go:101] "Starting endpoint slice config controller"
I0809 13:06:34.734842       1 shared_informer.go:313] Waiting for caches to sync for endpoint slice config
I0809 13:06:34.734809       1 config.go:192] "Starting service config controller"
I0809 13:06:34.734860       1 config.go:319] "Starting node config controller"
I0809 13:06:34.734869       1 shared_informer.go:313] Waiting for caches to sync for service config
I0809 13:06:34.734871       1 shared_informer.go:313] Waiting for caches to sync for node config
I0809 13:06:34.835383       1 shared_informer.go:320] Caches are synced for service config
I0809 13:06:34.835473       1 shared_informer.go:320] Caches are synced for endpoint slice config
I0809 13:06:34.835472       1 shared_informer.go:320] Caches are synced for node config

 

answer : iptables

 

6. How does this Kubernetes cluster ensure that a kube-proxy pod runs on all nodes in the cluster? Inspect the kube-proxy pods and try to identify how they are deployed.

 

controlplane ~ ➜  kubectl get ds -n kube-system
NAME         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-proxy   2         2         2       2            2           kubernetes.io/os=linux   58m
weave-net    2         2         2       2            2           <none>                   58m

controlplane ~ ➜  k get all -n kube-system
NAME                                       READY   STATUS    RESTARTS      AGE
pod/coredns-768b85b76f-82cxf               1/1     Running   0             70m
pod/coredns-768b85b76f-mnvz8               1/1     Running   0             70m
pod/etcd-controlplane                      1/1     Running   0             71m
pod/kube-apiserver-controlplane            1/1     Running   0             71m
pod/kube-controller-manager-controlplane   1/1     Running   0             71m
pod/kube-proxy-cbbkp                       1/1     Running   0             70m
pod/kube-proxy-q559r                       1/1     Running   0             70m
pod/kube-scheduler-controlplane            1/1     Running   0             71m
pod/weave-net-dw2xn                        2/2     Running   1 (70m ago)   70m
pod/weave-net-lfrzn                        2/2     Running   0             70m

NAME               TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
service/kube-dns   ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   70m

NAME                        DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/kube-proxy   2         2         2       2            2           kubernetes.io/os=linux   71m
daemonset.apps/weave-net    2         2         2       2            2           <none>                   71m

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/coredns   2/2     2            2           70m

NAME                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/coredns-768b85b76f   2         2         2       70m

 

answer : using daemonset

'IT 기술 > k8s' 카테고리의 다른 글

[cka] Ingress Networking - 1  (0) 2024.08.13
[cka] CoreDNS in Kubernetes  (0) 2024.08.10
[cka] Networking Weave  (0) 2024.08.09
[cka] Deploy Network Solution  (0) 2024.08.09
[cka] CNI  (0) 2024.08.09

댓글