full_container_scheme/3.kubernetes/storage/nginx-nfs.yml

30 lines
1.1 KiB
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-nfs-test
namespace: test # 指定命名空间
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:alpine # 镜像openresty/openresty or nginx:alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
volumeMounts: # 挂载容器中的目录到pvc nfs中的目录
- name: www
mountPath: /usr/share/nginx/html
volumes:
- name: www
persistentVolumeClaim: # 指定pvc资源
claimName: nfs-pvc