<p>Assuming I have two multi-container pods and services for exposing the pods to the cluster. I also have Replication controller for maintaining the number of pods at any time. </p>

<p>The above cluster is an trivial example. In this point I have two pod files, two service files and two RC files. This makes the file management difficult. </p>

<p>I know that all the files can be put in a directory and use <strong>kubectl create -f directory</strong> to execute whole thing in a single command. But, I feel the file management is a overhead. Is there something like docker-compose.yml, where we can include all pods in a single file.</p>

<p>I would like to know the best practices for using kubernetes in production. Changing many files in production does not seem to be an good idea.</p>

<p>You can use triple dashes or List resource as in these examples:</p>

<ul>
<li><a href="https://github.com/kubernetes/kubernetes/blob/8fd414537b5143ab039cb910590237cabf4af783/hack/testdata/list.yaml" rel="noreferrer">List</a></li>
<li><a href="https://github.com/kubernetes/kubernetes/blob/8fd414537b5143ab039cb910590237cabf4af783/test/fixtures/doc-yaml/user-guide/multi-pod.yaml" rel="noreferrer">Triple Dashes</a></li>
</ul>

<p>examples:</p>

<p><strong>List</strong></p>

<pre><code>apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: Service
  metadata:
    name: list-service-test
  spec:
    ports:
    - protocol: TCP
      port: 80
    selector:
      app: list-deployment-test
- apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: list-deployment-test
    labels:
      app: list-deployment-test
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: list-deployment-test
      spec:
        containers:
          - name: nginx
            image: nginx
</code></pre>

<p><strong>Triple dash</strong>:</p>

<pre><code>---
apiVersion: v1
kind: Pod
metadata:
  labels:
    name: redis
    redis-sentinel: "true"
    role: master
  name: redis-master
spec:
  containers:
    - name: master
      image: kubernetes/redis:v1
      env:
        - name: MASTER
          value: "true"
      ports:
        - containerPort: 6379
      resources:
        limits:
          cpu: "0.5"
      volumeMounts:
        - mountPath: /redis-master-data
          name: data
    - name: sentinel
      image: kubernetes/redis:v1
      env:
        - name: SENTINEL
          value: "true"
      ports:
        - containerPort: 26379
  volumes:
    - name: data
      emptyDir: {}
---
apiVersion: v1
kind: Pod
metadata:
  labels:
    name: redis-proxy
    role: proxy
  name: redis-proxy
spec:
  containers:
  - name: proxy
    image: kubernetes/redis-proxy:v1
    ports:
    - containerPort: 6379
      name: api
</code></pre>
