下面是一个示例的 nginx deployment YAML 文件,使用 k8s 版本 v1.20.6:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

这个 YAML 文件定义了一个名为 nginx-deployment 的 Deployment,指定了副本数为 3。选择器标签 app: nginx 用于选择要管理的 Pod。

在 Pod 的模板中,指定了一个名为 nginx 的容器,使用了 nginx:latest 镜像,并将容器的 80 端口映射到主机

k8s 版本v1206写一个 nginx deployment yaml

原文地址: https://www.cveoy.top/t/topic/hHVR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录