Note:In releases older than Debian 12 and Ubuntu 22.04,/etc/apt/keyringsdoes not exist by default. You can create this directory if you need to, making it world-readable but writeable only by admins.
/etc/apt/keyring 경로를 만들어야한다.
2. What is the version ofkubeletinstalled?
3. How many nodes are part of kubernetes cluster currently? Are you able to runkubectl get nodes?
4. Lets now bootstrap akubernetescluster usingkubeadm.
The latest version of Kubernetes will be installed.
kubeadm 으로 부트 스트랩 해보자
5. InitializeControl Plane Node (Master Node). Use the following options:
apiserver-advertise-address- Use the IP address allocated to eth0 on the controlplane node
apiserver-cert-extra-sans- Set it tocontrolplane
pod-network-cidr- Set to10.244.0.0/16
Once done, set up thedefault kubeconfigfile and wait for node to be part of the cluster.
eth0를 보면 192.12.244.12/24
cidr 는 10.244.0.1/24
이제 노드를 가져올 수 있다 .
6. Generate a kubeadm join token
Or copy the one that was generated bykubeadm initcommand
test, web-service 파드 모두 같은 네임스페이스 디폴트 네임스페이스에 존재한다,
test에서 web-service로 web에 접속할 수 있다.
default 와 apps 로 분리되어있다고 가정해보자
url 을 사용할때 네임스페이스 정보도 같이 기입해야한다.
web-service.apps
도메인 네임을 자세히 보면
호스트 네임, 네임스페이스 , 타입이 들어간다.
마지막으로 어느 클러스터에 포함되는지 root 정보가 필요하다.
cluster.local 이 루트 도메인이다.
최종적으로
web-service.apps.svc.cluster.local 이런식으로 사용 가능하다.
파드의 경우 ip가 .에서 - 로 변경된다.
10.244.2.5 가 10-244-2-5 가 된다.
다른 네임스페이스에 있다면
네임스페이스가 달라진다.
223. CoreDNS in Kubernetes
ip를 갖는 파드 2개가 있다.
파드의 etc/hosts 파일을 보면 도메인 네임이 등록되어있다.
파드가 많아지면 /etc/hosts 폴더에 등록하는 것도 불가능하니까 dns에 등록한다.
etc/resolve.conf 파일에 네임 서버를 등록한다.
파드가 등록될때마다 dns 등록함으로서 도메인 네임으로 접속 가능하게 한다.
쿠버네티스에서 dns는 이름으로 저장하는 것이 아닌 .을 -로 표현해서 저장한다.
10-244-2-5
CoreDNS
쿠버네티스에서 coredns 가 도와준다.
이중화를 위해 레플리카셋에 두개 파드로 구현된다. ( 디플로이먼트 안에 레플리카셋)
coreDNS는 corefile 이라는 구성 파일을 필요로 한다.
/etc/coreDNS/Corefile
에러를 담당하는 여러 플러그인이 존재한다,
kubernetes 부분에 탑레벨 도메인이 들어간다. cluster.local
configmap 으로도 coredns는 존재한다.
coredns는 kube-dns 라는 서비스와도 연결되어 있어 클러스터내에서 사용가능하다.
파드의 네임서버를 등록할때 이 서비스 ip를 등록한다.
kube-dns 10.96.0.10
var/lib/kubelet/config.yaml 파일을 통해서 dns의 ip 와 도메인을 확인할 수 있다.
이제 파드에서 모두 사용가능
host 명령으로 도메인 확인 가능
resolv.conf 파일에 온갖 이름이 다 있다.
224. Practice Test - Explore DNS
1. Identify the DNS solution implemented in this cluster
coreDNS 를 사용
2. How many pods of the DNS Server are deployed?
2개
3. What is the name of the service created for accessing CoreDNS?
kube-dns
4. what is the IP of the CoreDNS server that should be configured on PODs to resolve services?
서비스 클러스터 ip 10.96.0.10
5. where is the configuration file located for configuring the CoreDNS service?
deployments 를 통해 확인
/etc/coredns/Corefile
6. How is the Corefile passed into the CoreDNS POD?
pulled from git Stored on the kube master Configured as a ConfigMap object Corefile comes built-in with CoreDNS pod
config map
config map 형식으로 넘겨진다.
7. what is the name of the ConfigMap object created for corefile?
coredns
8. what is the root domain/zone configured for this kubernetes cluster?
cluster.local
9. we have deployed a set of PODs and Services in thedefaultandpayrollnamespaces. Inspect them and go to the next question.'
10. What name can be used to access thehrweb server from thetestApplication?
You can execute a curl command on thetestpod to test. Alternatively, the test Application also has a UI. Access it using the tab at the top of your terminal namedtest-app.
web-service 로 접속
11. which of the names CANNOT be used to access the HR service from the test pod?
We just deployed a web server -webapp- that accesses a databasemysql- server. However the web server is failing to connect to the database server. Troubleshoot and fix the issue.
They could be in different namespaces. First locate the applications. The web server interface can be seen by clicking the tabWeb Serverat the top of your terminal.
호스트 네임을 변경한다. mysql.payroll
그냥 서비스
payroll 네임스페이스에는 mysql 이 존재한다.
15. From thehrpodnslookupthemysqlservice and redirect the output to a file/root/CKA/nslookup.out
1. We have deployed Ingress Controller, resources and applications. Explore the setup.
2. Which namespace is theIngress Controllerdeployed in?
ingress-nginx
3. What is the name of the Ingress Controller Deployment?
ingress-nginx-controller
4. Which namespace are the applications deployed in?
app-space
5. How many applications are deployed in theapp-spacenamespace?
Count the number of deployments in this namespace.
3개
6. Which namespace is the Ingress Resource deployed in?
app space
7. what is the name of the ingress resource?
ingress-wear-watch
8. What is theHostconfigured on theIngress Resource?
The host entry defines the domain name that users use to reach the application likewww.google.com
all host
9. What backend is the/wearpath on the Ingress configured with?
wear-service
10. At what path is the video streaming application made available on theIngress?
/watch
11. If the requirement does not match any of the configured paths what service are the requests forwarded to?
no service
12. Now view the Ingress Service using the tab at the top of the terminal. Which page do you see?
404 error page
13. View the applications by appending/wearand/watchto the URL you opened in the previous step.
14. You are requested to change the URLs at which the applications are made available.
Make the video application available at/stream.
15. View the Video application using the/streamURL in your browser.
16. A user is trying to view the/eatURL on the Ingress Service. Which page would he see?
17. Due to increased demand, your business decides to take on a new venture. You acquired a food delivery company. Their applications have been migrated over to your cluster.
18. You are requested to add a new path to your ingress to make the food delivery application available to your customers.
Make the new application available at/eat.
19. View the Food delivery application using the/eatURL in your browser.
20. A new payment service has been introduced. Since it is critical, the new application is deployed in its own namespace.
critical space
21. What is the name of the deployment of the new application?
webapp-pay
22. You are requested to make the new application available at/pay.
pay-service 가 있다 포트 8282 확인
ingress 만들기
23. View the Payment application using the/payURL in your browser.
231. Practice Test - Ingress - 2
1. We have deployed two applications. Explore the setup.
2. Let us now deploy an Ingress Controller. First, create a namespace calledingress-nginx.
We will isolate all ingress related objects into its own namespace.
3. The NGINX Ingress Controller requires a ConfigMap object. Create a ConfigMap object with nameingress-nginx-controllerin theingress-nginxnamespace.
4. The NGINX Ingress Controller requires two ServiceAccounts. Create both ServiceAccount with nameingress-nginxandingress-nginx-admissionin theingress-nginxnamespace.
5. We have created the Roles and RoleBindings for the ServiceAccount. Check it out!!
6. Let us now deploy the Ingress Controller. Create the Kubernetes objects using the given file. The Deployment and it's service configuration is given at/root/ingress-controller.yaml. There are several issues with it. Try to fix them.