해당 내용은 Udemy의 Certified Kubernetes Administrator (CKA) with Practice Tests 강의를 공부한 내용입니다. 내용을 그대로 번역하기보다는, 제가 이해하기 쉬운 대로 수정한 부분들이 있습니다.
⚠️ 영어 독해가 많이 부족합니다. 틀린 내용이 있으면 알려주시면 감사하겠습니다.
Q1. In this lab, you will get hands-on practice with creating Kubernetes objects imperatively.
Q2. Deploy a pod named nginx-pod
using the nginx:alpine
image.
kubectl run nginx-pod --image=nginx:alpine
로 생성합니다.

Q3. Deploy a redis
pod using the redis:alpine
image with the labels set to tier=db
.
kubectl run --help
로 label 을 줄 수 있는 옵션이 있는지 살펴보았습니다.

-l 옵션으로 줄 수 있다고 합니다.
따라서 kubectl run redis --image=redis:alpine -l=tier=db
로 파드를 생성합니다.

Q4. Create a service redis-service
to expose the redis
application within the cluster on port 6379
.
서비스를 만드는 imperative 방법은 3가지 입니다. 그 중 kubectl expose를 권장하였으니 해당 커맨드를 사용해서 만들어봅시다.
kubectl expose --help

도움말의 도움을 받아 커맨드를 작성합니다.

Q5. Create a deployment named webapp
using the image kodekloud/webapp-color
with 3
replicas.

Q6. Create a new pod called custom-nginx
using the nginx
image and expose it on container port 8080
.

Q7. Create a new namespace called dev-ns
. Use imperative commands.

Q8. Create a new deployment called redis-deploy
in the dev-ns
namespace with the redis
image. It should have 2
replicas.

Q9. 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
.
파드를 생성하기 전 kubectl run --help
로 도움을 받아봅시다.

파드와 연관된 ClusterIP를 만드려면 —expose 옵션에 true를 주라고 되어있습니다. —port도 필수라고 하네요.
파드를 만들어 줍니다.

잘 만들어졌는지 확인해봅시다.

pod와 service모두 httpd라는 이름으로 생성된 것을 확인할 수 있습니다.
'MLOps > Doker & Kubernetes' 카테고리의 다른 글
Udemy CKA 강의 정리 48: Here’s some inspiration to keep going (0) | 2023.01.05 |
---|---|
Udemy CKA 강의 정리 47: Kubectl Apply Command (0) | 2023.01.05 |
Udemy CKA 강의 정리 45: Practice Test - Imperative Commands (0) | 2023.01.05 |
Udemy CKA 강의 정리 44: Certification Tips - Imperative Commands with kubectl (0) | 2023.01.05 |
Udemy CKA 강의 정리 43: Imperative vs Declarative (0) | 2023.01.05 |
댓글