Skip to Content
Kubernetes即学即用(第二版)
book

Kubernetes即学即用(第二版)

by Brendan Burns, Joe Beda, Kelsey Hightower
June 2021
Intermediate to advanced
300 pages
5h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Kubernetes即学即用(第二版)
222
15
- --replSet
- rs0
ports:
- containerPort: 27017
name: web
# This container initializes the mongodb server, then sleeps.
- name: init-mongo
image: mongo:3.4.1
command:
- bash
- /config/init.sh
volumeMounts:
- name: config
mountPath: /config
volumes:
- name: config
configMap:
name: "mongo-init"
有了所有这些文件后,我们就可以使用以下命令创建一个
Mongo
集群:
$
kubectl apply -f mongo-config-map.yaml
$
kubectl apply -f mongo-service.yaml
$
kubectl apply -f mongo.yaml
如有需要,你也可以将它们合并到一个
YAML
文件中,不要忘记利用
---
分隔各个对象。确保各个对象之间的顺序保持不变,因为状态集的定义要求
ConfigMap
定义必须存在。
15.3.4
持久卷与状态集
对于持久性存储,你需要将持久卷挂载到
/data/db
目录中。你需要修改 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
Python数据分析

Python数据分析

Posts & Telecom Press, Ivan Idris
Python贝叶斯分析(第2版)

Python贝叶斯分析(第2版)

Posts & Telecom Press, Osvaldo Martin
Python高级编程(第2版)

Python高级编程(第2版)

Posts & Telecom Press, Michał Jaworski, Tarek Ziadé

Publisher Resources

ISBN: 9787519856762