In the previous post we’ve seen Introduction to K8s Pods, In this post we will be writing manifest file to deploy K8s Pod.
In case you’re wondering what are manifest file, So,
Kubernetes manifests are used to create, modify and delete Kubernetes resources such as pods, deployments, services or ingresses. It is very common to define manifests in form of .yaml.
So let’s get started,
Open any of the Editor in my case I’ll be using VSCode and create a file call mypod.yaml and write the below code.
apiVersion: v1 kind: Pod metadata: name: my-nginx labels: name: nginx spec: containers: - name: nginx-container image: nginx
Now navigate to your K8s cluster and run the below command.
kubectl apply -f mypod.yml
Once you’ve run this command run below command to check the status of your pod.
kubectl get pods # get the status of pods kubectl get pods -o wide #get the detailed info of pod
So this is how you run your first pod in K8s cluster!! I hope you can now certainly get started with Pods!! Post your queries in comment section.