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即学即用(第二版)
部署实际应用程序
253
name: redis-config
name: config
- emptyDir:
name: data
volumeMounts:
- mountPath: /redis-config
name: config
- mountPath: /redis-data
name: data
- command: [sh, -c, source /redis-config/sentinel.sh]
image: redis:3.2.7-alpine
name: sentinel
volumeMounts:
- mountPath: /redis-config
name: config
你可以看到这个
Pod
中有两个容器。一个运行我们创建的
init.sh
脚本和
Redis
主服务器,另一个运行监视服务器的
redis-sentinel
此外,这个
Pod
中还定义了两个卷。一个卷使用我们的
ConfigMap
来配置两
Redis
应用程序,另一个卷是简单的
emptyDir
卷,映射到
Redis
服务器的
容器中,负责保存应用程序的数据,保证容器重启时数据不会丢失。如果你
想要更可靠的
Redis
安装,则可以采用网络存储,请参见第
15
章的讨论。
到此为止,
Redis
集群已经定义好了,下面我们通过以下命令来创建它:
$
kubectl apply -f ...
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