<p>I am new to kubernetes. In docker I can use the official mongo image and run docker run --name some-mongo -d mongo --auth</p>

<p>And then connect to it and create a default db user. How can I pass --auth in a kube controller spec?</p>

<p>Replication Controller</p>

<pre><code># db-controller.yml
apiVersion: v1
kind: ReplicationController
metadata:
  labels:
    name: mongo
  name: mongo-controller
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: mongo
    spec:
      containers:
      - image: mongo
        name: mongo
        ports:
        - name: mongo
          containerPort: 27017
          hostPort: 27017
        volumeMounts:
            - name: mongo-persistent-storage
              mountPath: /data/db
      volumes:
        - name: mongo-persistent-storage
          gcePersistentDisk:
            pdName: mongo-disk
            fsType: ext4
</code></pre>

<p>You can configure pod to run specific command and any arguments, in your case it should be something like this:</p>

<pre><code>containers:
  - image: mongo
    name: mongo
    command: ["mongo", "--auth"]
</code></pre>

<p>or </p>

<pre><code>containers:
  - image: mongo
    name: mongo
    args: ["--auth"]
</code></pre>

<p>more details could be found <a href="http://kubernetes.io/docs/user-guide/configuring-containers/" rel="noreferrer">here</a></p>
