[root@master Chapter7]# cat 7-2-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: registry.cn-beijing.aliyuncs.com/qingfeng666/nginx:latest
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
[root@master Chapter7]# kc get pod
NAME READY STATUS RESTARTS AGE
7-2 深入理解deployment
最新推荐文章于 2024-10-15 14:23:32 发布
本文档通过一个`7-2-deployment.yaml`配置文件展示了如何创建一个Kubernetes Deployment,用于部署nginx应用。配置中定义了2个副本,选择器匹配标签`app: nginx`,并详细描述了容器的资源限制、端口映射等信息。通过`kubectl get pod`命令,可以看到集群内相关Pod的状态,包括新建、运行和终止等状态。
摘要由CSDN通过智能技术生成