kubernetes-yaml/description/Workload/Deployment/description.yml

46 lines
1.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Deployment 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/deployment
# API 版本
apiVersion: apps/v1
# 资源类型
kind: Deployment
# 元数据
metadata:
## 名称
name: 此 Deployment 的名称
## 命名空间
namespace: 此 Deployment 所属命名空间
## 标签
labels:
标签名1: 标签值1
标签名2: 标签值2
# 内容
spec:
## 指定副本数
replicas: 期望副本数
## 指定 Pod 选择器( 此 Deployment 需要管理哪些 Pod
selector:
### 指定标签选择器
matchLabels:
标签名1: 标签值1
标签名2: 标签值2
## 指定 Pod 模板
template:
### Pod 的元数据
metadata:
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
labels:
标签名1: 标签值1
标签名2: 标签值2
### Pod 的内容
spec:
#### Pod 的容器
containers:
##### 容器1
###### 容器1的名称
- name: 容器1的名称
###### 容器1使用的镜像
image: 容器1使用的镜像
###### 容器1使用的端口号
ports:
- containerPort: 80