rc\deploment\service\nfspv\pvc文件 k8s 1.8


PVC
apiVersion : v1
kind : PersistentVolumeClaim
metadata :
name : pvc
spec :
accessModes :
- ReadWriteOnce
resources :
requests :
storage : 1G

storageClassName: abcd pv 和pvc可以绑定
PV

apiVersion : v1
kind : PersistentVolume
metadata :
name : nfs1
spec :
capacity :
storage : 1G
accessModes :
- ReadWriteOnce
nfs :
path : /abcd/nfsfile
server : 192.168.1.120

RC
apiVersion: v1
kind: ReplicationController
metadata:
name: myweb3

labels:

name: nginx001

spec:
replicas: 3
selector:
name: myweb3
template:
metadata:
labels:
app : myweb3
name: myweb3
spec:
containers:
- name: myweb3
image: docker.io/nginx:1.12.2
ports:
- containerPort: 80
volumeMounts :
- mountPath : "/usr/share/nginx/html"
name : mypd
volumes :
- name : mypd
persistentVolumeClaim :
claimName : pvc

Service

apiVersion: v1
kind: Service
metadata:
name: myweb3
spec:
type: NodePort
ports:
- port : 9999
targetPort: 80
nodePort: 30004
selector:
app: myweb3

Deployment

apiVersion: apps/v1beta2

1.8用apps/v1beta2 1.9可以直接用apps/v1

kind: Deployment
metadata:
name: myweb1

labels:

name: nginx001

spec:
replicas: 3
selector:
matchLabels :
name: myweb1
template:
metadata:
labels:
app : myweb1
name: myweb1
spec:
containers:
- name: myweb1
image: docker.io/nginx:1.12.2
ports:
- containerPort: 80

server 2
apiVersion: v1
kind: Service
metadata:
name: tatata
spec:
type: NodePort
ports:
- port : 9999
targetPort: 80
nodePort: 30002
selector:
app: myweb1

1 个评论

N久没出来了,混个脸

要回复文章请先登录注册