Exercise-1
-
Deploy a pod named
nginx-podusing thenginx:alpineimagekubectl run nginx-pod --image=nginx:alpine -
Deploy a
redispod using theredis:alpineimage with the labels set to tier=db.kubectl run redis --image=redis:alpine --labels=tier=db -
Create a service
redis-serviceto expose theredisapplication within the cluster on port6379.kubectl expose pod redis --name=redis-service --port=6379 -
Create a deployment named
webappusing the imagekodekloud/webapp-colorwith 3 replicaskubectl create deployment webapp --image=kodekloud/webapp-colorkubectl scale deployment webapp --replicas=3 -
Create a new pod called
custom-nginxusing thenginximage and expose it on container port8080kubectl run custom-nginx --image=nginx --port=8080 -
Create a new namespace called
dev-ns.kubectl create namespace dev-ns -
Create a new deployment called
redis-deployin thedev-nsnamespace with theredisimage. It should have2replicas.kubectl create deployment redis-deploy -n dev-ns --image=rediskubectl scale deployment redis-deploy -n dev-ns --replicas=2 -
Create a pod called
httpdusing the imagehttpd:alpinein the default namespace. Next, create a service of typeClusterIPby the same name(httpd). The target port for the service should be 80.kubectl run httpd --image=httpd:alpinekubectl expose pod httpd --port=80