kubernetes/Yaml文件/pv-pvc-deployment.yaml

78 lines
1.2 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: tgrjm
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: tgrjm-pv
namespace: tgrjm
spec:
capacity:
storage: 1000Mi
accessModes:
- ReadWriteMany
nfs:
server: 10.36.174.164
path: /kubernetes-4
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tgrjm-pvc
namespace: tgrjm
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 90Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tgrjm
namespace: tgrjm
labels:
app: tgrjm
spec:
replicas: 2
selector:
matchLabels:
app: tgrjm
template:
metadata:
labels:
app: tgrjm
spec:
containers:
- name: nginx
image: 10.36.174.164/xingdian/nginx:v1
ports:
- containerPort: 80
volumeMounts:
- name: tgrjm
mountPath: /usr/share/nginx/html
volumes:
- name: tgrjm
persistentVolumeClaim:
claimName: tgrjm-pvc
---
apiVersion: v1
kind: Service
metadata:
name: tgrjm
namespace: tgrjm
spec:
selector:
app: tgrjm
type: NodePort
ports:
- port: 80
targetPort: 80