Q1. Deploy a pod named nginx-pod using the nginx:alpine image.
k run nginx-pod --image=nginx:alpine
Q2. Deploy a redis pod using the redis:alpine image with the labels set to tier=db.
k run redis --image=redis:alpine --labels=tier=db
Q3. Create a service redis-service to expose the redis application within the cluster on port 6379.
명령어 예시 공식문서
kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]
k expose pods redis --port=6379 --name=redis-service
[공식문서] 쿠버네티스 서비스 객체로 클러스터에 접근하기
# service 정보 표시하기
kubectl describe services redis-service
'''서비스 생성시 포트를 6379로 했어야했는데 6370으로 잘못침..'''
Q4. Create a deployment named webapp using the image kodekloud/webapp-color with 3 replicas.
k create deployment webapp --image=kodekloud/webapp-color --replicas=3
Q5. Create a new pod called custom-nginx using the nginx image and expose it on container port 8080.
k run custom-nginx --image=nginx --port=8080
Q6.Create a new namespace called dev-ns. Use imperative commands.
Q7. Create a new deployment called redis-deploy in the dev-ns namespace with the redis image. It should have 2 replicas
k create deployment redis-deploy --namespace=dev-ns --image=rdis --replicas=2
Q8. Create a pod called httpd using the image httpd:alpine in the default namespace. Next, create a service of type ClusterIP by the same name (httpd). The target port for the service should be 80.
k run httpd --image=httpd:alpine --port=80 --expose
'STUDY > Data Engineering' 카테고리의 다른 글
[kodekloud] 02 Scheduling : Labels and Selectors 풀이 (0) | 2023.01.22 |
---|---|
[kodekloud] 02 Scheduling : Manual Scheduling 풀이 (0) | 2023.01.21 |
[kodekloud] 01 Core Concepts : Service 풀이 (0) | 2023.01.21 |
[kodekloud] 01 Core Concepts : Namespaces 풀이 (0) | 2023.01.21 |
14. CKA udemy 강의 정리 - Section 7 [Networking] (0) | 2023.01.21 |