单实例mysql.yaml kubernetes
借助于容器和k8s管理平台,mysql的部署和使用都很方便,能满足平时开发测试环境使用
client
集群内:
mysql -h mysql.default.svc.cluster.local -P3306 -uroot -p mysqlimage
percona:5.7.22
yaml
其中PersistentVolumeClaim的storageClassName,可更改为平台支持的存储类型
apiVersion: apps/v1 kind: Deployment metadata: name: mysql spec: replicas: 1 selector: matchLabels: name: mysql template: metadata: labels: name: mysql spec: containers: - name: mysql image: percona:5.7.22 imagePullPolicy: Always ports: - containerPort: 3306 resources: limits: memory: "500Mi" cpu: "500m" requests: memory: "500Mi" cpu: "250m" env: - name: MYSQL_ROOT_PASSWORD value: "mysql" volumeMounts: - name: mysql-pvc mountPath: /var/lib/mysql volumes: - name: mysql-pvc persistentVolumeClaim: claimName: mysql --- kind: Service apiVersion: v1 metadata: name: mysql spec: type: ClusterIP ports: - name: mysql port: 3306 targetPort: 3306 protocol: TCP selector: name: mysql --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql spec: accessModes: - ReadWriteMany resources: requests: storage: "5Gi" volumeName: storageClassName: glusterfs
相关推荐
暗夜之城 2020-11-11
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11