20 How to create Pod using Kubectl command (Imperative Mode) with Port and Label Options?
How to create Pod using Kubectl command (Imperative Mode) with Port and Label Options?
To create a Pod using the kubectl command in imperative mode with port and label options, you can use the following command:
kubectl run pod-name –image=container-image –port=container-port –labels=key1=value1,key2=value2,…
Here’s a breakdown of the command:
pod-name: Replace this with the desired name for your Pod.
–image=container-image: Specify the container image you want to use for your Pod.
–port=container-port: Specify the port number to expose in the container.
–labels=key1=value1,key2=value2,…: Assign labels to your Pod by providing comma-separated key-value pairs.
For example, let’s create a Pod named “webserver” using the “nginx:1.16-alpine” container image, exposing port 80, and assigning a label “app=web”:
kubectl run webserver –image=nginx:1.16-alpine –port=80 –labels=app=nginxweb
Once executed, the Pod will be created with the specified configuration. You can verify its creation using the kubectl get pods command.
#kubernetes #kubernetesfulltutorial #kubernetesforbeginners #kubernetesvolumes #devops #docker #kubernetesnetworking #k8s #cluster #kubernetesarchitecture #whatiskubernetes #whatisdevops #pod #linux #centos7 #vm #pvc #vipingupta #techtrendswithvipingupta #devopstutorial #kubernetespods #deployment #replicas #loadbalancer #ingress #canary #bluegreen #containers #container #dockervideos #dockercontainer #dockertraining #dockertutorial #kubernetescrashcourse #kubernetesservices #kuberneteswithvipin
Comments are closed.