In the previous blog, we have learned to install minikube on ubuntu server. You can refer it: https://kshitijaa.hashnode.dev/minikube-installation-guide-for-ubuntu
Let's Create the First Pod On K8s through Minikube!
What is Pod?
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers which are relatively tightly coupled.
In Kubernetes, everything is written in a YAML file (known as Manifest File) which is a key-value combination.
Create a file named pod.yml as below.
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
This is the pod file.
We are just creating a container, image will be nginx and the container port is 80, in which the container will be listening
run the kubectl apply the command to create a pod.
kubectl apply -f pod.yml
Check the pod's status by kubectl get pods,you can see a pod is created successfully from its status
Run the kubectl get pods -o wide command to get more detailed information about the pod.
kubectl get pods -o wide
To check if nginx is running locally or not, do minikube ssh to go inside of the minikube cluster.
minikube ssh
You can see Nginx is running locally.