external-mysql
考虑到数据存储的重要性, 数据库单独存放会更好一些
[root@master test]# cat external-mysql-service.yaml
## 接入外部IP方式
#kind: Service
#apiVersion: v1
#metadata:
# name: external-mysql #保持与下面endpoint的metadata.name一致
# labels:
# name: external-mysql #保持与下面endpoint的metadata.labels.name一致
#spec:
# clusterIP: None
# ports:
# - port: 3006
# name: external-mysql #这名字理论上随意
# targetPort: 3006
#---
#kind: Endpoints
#apiVersion: v1
#metadata:
# name: external-mysql
# labels:
# name: external-mysql
#subsets:
# - addresses:
# - ip: 192.168.1.1 #这里是数据库的ip地址
# ports:
# - port: 3306 #数据库端口
## 接入外部域名的方式
kind: Service
apiVersion: v1
metadata:
name: external-mysql #保持与下面endpoint的metadata.name一致
labels:
name: external-mysql #保持与下面endpoint的metadata.labels.name一致
spec:
type: ExternalName
externalName: singlenode-mysql.default.svc.cluster.local
Last updated