k8s 对接glusterfs存储
service 与 endpoint 是通过namespace相同,name相同,相互关联的
创建endpoint
[ glusterfs]# cat glusterfs-ep.yaml apiVersion: v1 kind: Endpoints metadata: name: glusterfs namespace: tomcat subsets: - addresses: - ip: 10.0.0.11 - ip: 10.0.0.12 - ip: 10.0.0.13 ports: - port: 49152 protocol: TCP [ glusterfs]# cat glusterfs-svc.yaml apiVersion: v1 kind: Service metadata: name: glusterfs namespace: tomcat spec: ports: - port: 49152 protocol: TCP targetPort: 49152 sessionAffinity: None type: ClusterIP 使用yml文件创建
tomcat-mysql配置文件修改
[ tomcat_demo]# cat mysql-rc.yml apiVersion: v1 kind: ReplicationController metadata: namespace: tomcat name: mysql spec: replicas: 1 selector: app: mysql template: metadata: labels: app: mysql spec: volumes: - name: mysql glusterfs: path: oldxu endpoints: glusterfs containers: - name: mysql image: 10.0.0.11:5000/mysql:5.7 volumeMounts: - name: mysql mountPath: /var/lib/mysql ports: - containerPort: 3306 env: - name: MYSQL_ROOT_PASSWORD value: '123456'
删除旧的,按照新的yml文件创建
kubectl delete -f .
kubectl create -f .
提示,这里可能会有坑,原因:数据库创建时,目录必须是空的,否则无法创建数据库,我们删除/mnt的所有数据即可
相关推荐
loviezhang 2019-12-26
yevvzi 2019-12-08
xiunai 2019-10-23
88344556 2019-05-17
YZR 2016-11-25
大杂烩 2014-07-31
nenusoulcsdn 2015-10-21
weixuedianzi 2014-02-21
fenggj0 2017-02-11
MichaelHsu 2016-10-20
liusaisoso 2015-11-12
dqcoffee 2015-01-03
80427816 2013-08-20
zyshappy 2013-08-20
勿六七 2013-08-20