Exercise-1
-
Deploy a pod named
nginx-pod
using thenginx:alpine
imagekubectl run nginx-pod --image=nginx:alpine
-
Deploy a
redis
pod using theredis:alpine
image with the labels set to tier=db.kubectl run redis --image=redis:alpine --labels=tier=db
-
Create a service
redis-service
to expose theredis
application within the cluster on port6379
.kubectl expose pod redis --name=redis-service --port=6379
-
Create a deployment named
webapp
using the imagekodekloud/webapp-color
with 3 replicaskubectl create deployment webapp --image=kodekloud/webapp-color
kubectl scale deployment webapp --replicas=3
-
Create a new pod called
custom-nginx
using thenginx
image and expose it on container port8080
kubectl 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-deploy
in thedev-ns
namespace with theredis
image. It should have2
replicas.kubectl create deployment redis-deploy -n dev-ns --image=redis
kubectl scale deployment redis-deploy -n dev-ns --replicas=2
-
Create a pod called
httpd
using the imagehttpd:alpine
in the default namespace. Next, create a service of typeClusterIP
by the same name(httpd)
. The target port for the service should be 80.kubectl run httpd --image=httpd:alpine
kubectl expose pod httpd --port=80