Deploying a pod

As mentioned earlier, Kubernetes relies heavily on Yet Another Markup Language (YAML) files to configure API elements. In order to deploy a pod, we need to create a yaml file, but first, just create a folder called deployments, where we are going to create all the descriptors that we will be created on this section. Create a file called pod.yaml (or pod.yml) with the following content:

apiVersion: v1kind: Podmetadata:  name: nginx  labels:    name: nginxspec:  containers:  - name: nginx     image: nginx     ports:      - containerPort: 80     resources:       requests:         memory: "64Mi"         cpu: "250m"

As you can see, the preceding yaml is fairly descriptive, but some points need clarification:

  • apiVersion: This is the version of the Kubernetes API that we are ...

Get Implementing Modern DevOps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.