A pod will have its IP address, and all the containers inside it will share the same storage network and IP address. We will go through a demo to see that in detail. We already have a file that I just showed you. You can see that this is a sample file, and I do not have any pods running inside the cluster and the default namespace. Hence, we can create the pod by using the command kubectl create -f sample-pod.yaml. We will supply the YAML file, and the pod will get created.
We can check the creation of the pod using kubectl get pods, and we have a pod running. If we want to see additional details, we will use the kubectl get pods -o wide command. It tells you the pod name, the status, the number of ready containers, the number of restarts that happen, the IP that it's assigned, and the node on which it's running. Then you have other readiness and the gates, if applicable, if specified in the YAML file, which we'll discuss in future lectures. Now, a pod can also be created using the imperative way. We will use the command kubectl run demo --image=nginx --port=80 to create it through the imperative way. Again, a pod is created, and if we do not specify any namespace in the YAML file, it gets created in the default namespace. Now, if we use the kubectl get pods command, we will see the two pods listed as the output. So, we have a sample pod created by the YAML file, and then I have a demo pod created using the imperative way.