我正在部署一个mongodb ReplicaSeton GKE.
我的部署有效,但是我想在 Mongo 上启用身份验证。
我已连接到我的 pod
kubectl exec -it {pod_name} mongo admin
为我的数据库创建了一个管理员用户和一个用户。然后我想我可以mongo-statefulset.yaml用--auth标志更新并应用更新的yaml.
就像是
.....
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongod-container
image: mongo:3.6
command:
- mongod
- "--bind_ip"
- "0.0.0.0"
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
- "--auth"
ports:
- containerPort: 27017
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
.....
但是跑步kubectl apply -f mongo-statefulset.yaml只会产生
服务/mongo-svc 不变
statefulset.apps/mongo 已配置
我应该重新启动我的 pod 以使其现在生效吗?