stateful set 学习笔记
生活随笔
收集整理的這篇文章主要介紹了
stateful set 学习笔记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
1、創建pv
# cat pv.yaml kind: PersistentVolume apiVersion: v1 metadata:name: task-pv-volumelabels:type: local spec:capacity:storage: 3GiaccessModes:- ReadWriteOncehostPath:path: "/tmp/data"2、創建pvc
apiVersion: v1 kind: PersistentVolumeClaim metadata:name: db-mysql-0 spec:accessModes:- ReadWriteOnceresources:requests:storage: 1Gi3、創建svc
apiVersion: v1 kind: Service metadata:name: mysql-servicelabels:app: mysql spec:ports:- port: 80name: my-portclusterIP: Noneselector:app: mysql4、創建ss
apiVersion: apps/v1beta1 kind: StatefulSet metadata:name: mysqlnamespace: default spec:serviceName: "mysql-service"replicas: 2template:metadata:labels:app: mysqlspec:terminationGracePeriodSeconds: 10containers:- name: mysqlimage: mysql:5.7.14ports:- containerPort: 3306name: my-portenv:- name: MYSQL_ROOT_PASSWORDvalueFrom:secretKeyRef:name: mysql-configkey: MYSQL_ROOT_PASSWORDvolumeMounts:- name: dbmountPath: /var/lib/mysqlvolumeClaimTemplates:- metadata:name: dbspec:accessModes: [ "ReadWriteOnce" ]resources:requests:storage: 1Gi查看結果:
發現?
需要再創建一個pv供pvc綁定,這種靜態創建pv的方法很麻煩。
二、動態創建pv storage class
?
?
轉載于:https://my.oschina.net/u/3074507/blog/1568181
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的stateful set 学习笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RoboMaster 2017:机器人版
- 下一篇: 厉害了!中关村软件园人工智能军团有料有看