full_container_scheme/3.kubernetes/Manifests/nginx.yml

23 lines
789 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

apiVersion: apps/v1
kind: Deployment
metadata: # metadata是该资源的元数据name是必须的元数据项
name: nginx-deployment
namespace: test # 指定命名空间
labels:
app: nginx
spec: # spec部分是该Deployment的规则说明
replicas: 2
selector:
matchLabels:
app: nginx
template: # template定义Pod的模板这是配置的重要部分
metadata: # 定义Pod的元数据至少要顶一个labellabel的key和value可以任意指定
labels:
app: nginx
spec: # spec描述的是Pod的规则此部分定义pod中每一个容器的属性name和image是必需的
containers:
- name: nginx
image: nginx:1.23-debian-11 # 提供本地nginx镜像
ports:
- containerPort: 80