Core Concepts - Imperative Commands
Ju Young Pang
·2025. 1. 18. 16:25
Q) Deploy a pod named nginx-pod using the nginx:alpine image
$ k run nginx-pod --image=nginx:alpine
pod/nginx-pod created
Q) 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"
pod/redis created
Q) Create a service redis-service to expose the redis application within the cluster on port 6379.
$ k expose po redis --port=6379 --name=redis-service
service/redis-service exposed
Q) Create a deployment named webapp using the image kodekloud/webapp-color with 3 replicas.
$ k create deploy webapp --image=kodekloud/webapp-color --replicas=3
deployment.apps/webapp created
Q) Create a new pod called custom-nginx using the nginx image and run it on container port 8080.
$ k run custom-nginx --image=ngix --port 8080
Q) Create a new namespace called dev-ns.
$ k create ns dev-ns
namespace/dev-ns created
Q) Create a new deployment called redis-deploy in the dev-ns namespace with the redis image. It should have 2 replicas.
$ k create deploy redis-deploy -n dev-ns --image=redis --replicas=2
deployment.apps/redis-display created
Q) 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
service/httpd created
pod/httpd created
'Kubernetes > CKA' 카테고리의 다른 글
Scheduling - Labels and Selectors (0) | 2025.01.25 |
---|---|
Scheduling - Manual Scheduling (0) | 2025.01.18 |
Core Concepts - Services (0) | 2025.01.16 |
Core Concepts - Namespaces (0) | 2025.01.16 |
Core Concepts - Deployments (0) | 2025.01.16 |