Working with configuration files

Kubernetes supports two different file formats YAML and JSON. Each format can describe the same function of Kubernetes.

Getting ready

Both YAML and JSON have official websites to describe the standard format.


The YAML format is very simple with less syntax rules; therefore, it is easy to read and write by a human. To know more about YAML, you can refer to the following website link:

The following example uses the YAML format to set up the nginx pod:

apiVersion: v1
kind: Pod
  name: nginx
    name: nginx
  - name: nginx
    image: nginx
    - containerPort: 80


The JSON format is also simple and easy to read by humans, but more program-friendly. ...

Get DevOps: Puppet, Docker, and Kubernetes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.