본문 바로가기

CKA &. CKAD/Core Concepts

Practice Test - Imperative Command

ㅁ Deploy a pod named nginx-pod using the nginx:alpine image

 

kubectl run nginx-pod --image=nginx:alpine

 

ㅁ  Deploy a redis pod using the redis:alpine image with the labels set to tier=db

kubectl run redis --image=redis:alpine --label=tier-db

 

ㅁ Create a service redis-service to expose the redis application within the cluster on port 6379

kubectl expose pod redis --name redis-service --port 6379 --target-port 6379 

 

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

kubectl create deployment webapp --image=kodekloud/webapp-color

kubectl scale deployment webapp --replicas=3

 

ㅁ Create a new pod called custom-nginx using the nginx image and expose it on cotainer port 8080

kubectl run custom-nginx --image=nginx --port 8080

kubectl describe pod custom-nginx

 

ㅁ Create a new namespace called dev-ns

kubeclt create namespace dev-ns

 

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

kubectl create deployment redis-deploy  --image=redis --namespace=dev-ns --dry-run=client -o yaml > redis.yaml

reds.yaml에서 replica 수정 후

kubectl apply -f redis.yaml

 

ㅁ Create a pod called httpd using the image httpd:alpine in the default namespace. Next, create a service of the clusterIP by the same name (httpd). The target port for the service should be 80.

kubectl run httpd  --image=httpd:alpine --port 80 --expose

 

'CKA &. CKAD > Core Concepts' 카테고리의 다른 글

kubectl apply command  (0) 2021.03.25
CKA Tip 2: Imperative Command with kubectl  (0) 2021.03.25
Imperative vs Declarative  (0) 2021.03.24
Practice Test - Service  (0) 2021.03.24
Service  (0) 2021.03.24