kubernetes-101-pods
Kubernetes 101 – Pods
November 17, 2022
Andrei Saizu

Intro

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.

Example

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.

Follow the Kubernetes 101 series on mindit.io.

Check out new-spike.net for other articles on Kubernetes and much more!

Talk to the team

ASK US SOMETHING OR JUST SAY HELLO, WE'RE HERE.
Contact