I am new to kubernetes. In docker I can use the official mongo image and run docker run --name some-mongo -d mongo --auth
And then connect to it and create a default db user. How can I pass --auth in a kube controller spec?
Replication Controller
# 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
You can configure pod to run specific command and any arguments, in your case it should be something like this:
containers:
- image: mongo
name: mongo
command: ["mongo", "--auth"]
or
containers:
- image: mongo
name: mongo
args: ["--auth"]
more details could be found here