본문 바로가기

클라우드/CKA

[CKA] 네트워크 & 리눅스 명령어

ip 네트워크 eth0의 상태 확인

ip link show eth0

 

default gateway를 얻는 방법

ip route show default

 

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

netstat -tnlp

 

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

root@controlplane:~# netstat -anp | grep etcd | grep 2380 | wc -l
1
root@controlplane:~# netstat -anp | grep etcd | grep 2379 | wc -l
81

-a : 모두

-t (tcp) : tcp

-n (number port) : 포트 넘버

-l (listen) : 연결 가능한 상태

-p : 프로그램 이름 / PID

netstat -nap : 연결을 기다리는 목록과 프로그램을 보여준다
netstat -an | grep 포트번호 : 특정 포트가 사용 중에 있는지 확인 
netstat -nlpt : TCP listening 상태의 포트와 프로그램을 보여준다

 

wc -l: 행의 갯수를 세는 명령어

 

Inspect the kubelet service and identify the network plugin configured for Kubernetes.

root@controlplane:~# ps -aux | grep kubelet | grep --color network-plugin=   
root      4645  0.0  0.0 4151068 109296 ?      Ssl  03:59   0:30 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.2

 

Identify which of the below plugins is not available in the list of available CNI plugins on this host?

root@controlplane:~# ls /opt/cni/bin/
bandwidth  dhcp      flannel      host-local  loopback  portmap  sbr     tuning
bridge     firewall  host-device  ipvlan      macvlan   ptp      static  vlan

 

What is the CNI plugin configured to be used on this kubernetes cluster?

root@controlplane:/etc/cni/net.d# ls
10-flannel.conflist

 

What binary executable file will be run by kubelet after a container and its associated namespace are created.

root@controlplane:/etc/cni/net.d# cat 10-flannel.conflist 
{
  "name": "cbr0",
  "cniVersion": "0.3.1",
  "plugins": [
    {
      "type": "flannel",
      "delegate": {
        "hairpinMode": true,
        "isDefaultGateway": true
      }
    },
    {
      "type": "portmap",
      "capabilities": {
        "portMappings": true
      }
    }
  ]
}

 

What is the POD IP address range configured by weave?

root@controlplane:/etc/cni/net.d# ip addr show weave
5: weave: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1376 qdisc noqueue state UP group default qlen 1000
    link/ether 82:09:62:50:d2:ec brd ff:ff:ff:ff:ff:ff
    inet 10.50.0.1/16 brd 10.50.255.255 scope global weave
       valid_lft forever preferred_lft forever

 

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

root@controlplane:/etc/kubernetes/manifests# cat kube-apiserver.yaml 

--service-cluster-ip-range=10.96.0.0/12 확인

 

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

root@controlplane:/etc/kubernetes/manifests# kubectl logs kube-proxy-4zk6n -n kube-system 
W0116 05:04:31.810822       1 proxier.go:661] Failed to load kernel module ip_vs_wrr with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0116 05:04:31.813360       1 proxier.go:661] Failed to load kernel module ip_vs_sh with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
I0116 05:04:31.916432       1 node.go:172] Successfully retrieved node IP: 10.6.94.9
I0116 05:04:31.916483       1 server_others.go:142] kube-proxy node IP is an IPv4 address (10.6.94.9), assume IPv4 operation
W0116 05:04:31.938207       1 server_others.go:578] Unknown proxy mode "", assuming iptables proxy
I0116 05:04:31.960689       1 server_others.go:185] Using iptables Proxier.
I0116 05:04:32.051072       1 server.go:650] Version: v1.20.0
I0116 05:04:32.120793       1 conntrack.go:52] Setting nf_conntrack_max to 1179648
I0116 05:04:32.124462       1 conntrack.go:100] Set sysctl 'net/netfilter/nf_conntrack_tcp_timeout_established' to 86400
I0116 05:04:32.126199       1 config.go:224] Starting endpoint slice config controller
I0116 05:04:32.126218       1 config.go:315] Starting service config controller
I0116 05:04:32.126245       1 shared_informer.go:240] Waiting for caches to sync for service config
I0116 05:04:32.126235       1 shared_informer.go:240] Waiting for caches to sync for endpoint slice config
I0116 05:04:32.226491       1 shared_informer.go:247] Caches are synced for service config 
I0116 05:04:32.226504       1 shared_informer.go:247] Caches are synced for endpoint slice config

 

Where is the configuration file located for configuring the CoreDNS service?

root@controlplane:/etc# kubectl edit deployments.apps -n kube-system coredns

yaml 파일에 설정된 config 경로를 본다.

 

From the hr pod nslookup the mysql service and redirect the output to a file /root/CKA/nslookup.out

root@controlplane:~# kubectl exec -it hr -- nslookup mysql.payroll > /root/CKA/nslookup.out

'클라우드 > CKA' 카테고리의 다른 글

[CKA] 네트워크 & 리눅스 명령어  (0) 2022.01.16
[CKA] Advanced kubectl commands  (0) 2022.01.03
[CKA] Ligtning Lab  (0) 2022.01.02
[CKA] mock exam 03  (0) 2021.12.26
[CKA] mock exam 02  (0) 2021.12.26
[CKA] mock exam 01  (0) 2021.12.15