Commands to manage Pods using declarative YAML files:
-
View all Pods:
kubectl get pods
-
Create a Pod:
kubectl create -f pod-definition-example.yaml
Creates a Pod named
myapp-pod-nginx
with a container running thenginx
image. -
Describe a Pod:
kubectl describe pod myapp-pod-nginx
Provides detailed information about the Pod.
Commands to manage ReplicaSets using declarative YAML files:
-
View all ReplicaSets:
kubectl get replicasets
-
Create a ReplicaSet:
kubectl create -f replicaset-definition-example.yaml
Creates a ReplicaSet named
new-replica-set
with 4 Pods, each running thenginx
container. -
Describe a ReplicaSet:
kubectl describe replicaset new-replica-set
Provides detailed information about the ReplicaSet.
Commands to manage Deployments using declarative YAML files:
-
View all Deployments:
kubectl get deployment
-
Create a Deployment:
kubectl create -f deployment-definition-example.yaml
Creates a Deployment named
my-deployment
with 3 Pods, each running thenginx
container. -
Describe a Deployment:
kubectl describe deployment my-deployment
Provides detailed information about the Deployment.
Commands to manage ClusterIP Services:
-
View all Services:
kubectl get services
-
Create a ClusterIP Service:
kubectl create -f service-definition-clusterip-example.yaml
Creates a ClusterIP Service named
my-service-clusterIp
for labelapp:my-redis-service
on port6379
. -
Describe a ClusterIP Service:
kubectl describe services my-service-clusterIp
Provides detailed information about the Service.
Commands to manage NodePort Services:
-
View all Services:
kubectl get services
-
Create a NodePort Service:
kubectl create -f service-definition-nodeport-example.yaml
Creates a NodePort Service named
my-service-nodeport
for labelapp:my-redis-service
, exposing port80
internally and port30080
externally. -
Describe a NodePort Service:
kubectl describe services my-service-nodeport
Provides detailed information about the Service.
You can deploy the Voting App using either of the following approaches:
- Navigate to the
using-simple-pods
folder. - Create Pods for each YAML file:
kubectl create -f <yaml-file-name>
- Create the Services of the yaml files as described above.
- Navigate to the
using-deployment
folder. - Create Deployments for each YAML file:
kubectl create -f <yaml-file-name>
- Create the Services of the yaml files as described above.
Run the following commands in two separate terminals:
-
For the Voting Page:
minikube service voting-service --url
Returns a URL to access the voting page.
-
For the Result Page:
minikube service result-service --url
Returns a URL to access the result page.