[root@node1 Chapter11]# cat 11-2-kubeblog.yaml
apiVersion: v1
kind: Service
metadata:
name: kubeblog
spec:
selector:
app: kubeblog
type: NodePort
ports:
- port: 5000
targetPort: 5000
nodePort: 30002
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubeblog
spec:
selector:
matchLabels:
app: kubeblog
template:
metadata:
labels:
app: kubeblog
spec:
containers:
- name: kubeblog
image: registry.cn-beijing.aliyuncs.com/qingfeng666/kubeblog:1.3
ports:
- containerPort: 5000
env:
- name: MYSQL_PORT
value: "30306"
- name: MYSQL_SERVER
value: "192.168.137.11"
env:
kubectl 应用连接数据库
最新推荐文章于 2023-08-10 15:14:59 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)