kubernetes-101-pods
The Pod object is the fundamental building block in Kubernetes.
It’s made of one or more (tightly related) containers, a shared networking layer, and shared filesystem volumes.
Similar to containers, pods are meant to be ephemeral - there is no expectation that a specific pod will persist for a long lifetime.
Its blueprint can be defined in a json or yaml file where you'll specify what do you want your pod to contain and many more.
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
namespace: dev
spec:
containers:
- name: nginx-container
image: nginx:1.14.2
ports:
- containerPort: 80
In the example above we specify that we want a pod named nginx-pod to be instantiated in the dev namespace.
It should have a single container named nginx-container running the nginx:1.14.2 application and should expose to outside network traffic the port 80.
To create the pod you just need to:
>> kubectl apply -f nginx-pod.yaml
Which tells the Kubernetes client to create and start whatever resource is defined in that file.
Check out new-spike.net for other articles on Kubernetes and much more!