k8s连接mysql测试_k8s部署mysql
docker search mysqlvi msyql.yamlapiVersion: extensions/v1beta1kind: Deploymentmetadata:labels:app: mysqlname: mysqlspec:replicas: 1selector:matchLabels:app: mysqltemplate:metadata:labels:app: mysqlspe
docker search mysql
vi msyql.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: mysql
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql
name: mysql
imagePullPolicy: IfNotPresent
env:
- name: MYSQL_ROOT_PASSWORD
value: Changeme
创建一Service以便集群内外均可访问数据库,其中集群外需通过nodePort设置的30006端口访问。
vi msyql-service.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: mysql
name: mysql
spec:
type: NodePort
ports:
- port: 3306
nodePort: 30006
protocol: TCP
targetPort: 3306
selector:
app: mysql
kubectl get pod
kubectl exec -it mysql-5b5668c448-t44ml -- mysql -uroot -pChangeme
参考
https://segmentfault.com/a/1190000014966962
ceph配置
https://www.cnblogs.com/chimeiwangliang/p/8384243.html
k8s 配合ceph
https://www.cnblogs.com/chimeiwangliang/p/8386353.html
参考yaml
http://www.cnblogs.com/fuyuteng/p/9460534.html
更多推荐
所有评论(0)