ConsulManager/k8s-deploy.yaml

108 lines
2.3 KiB
YAML
Raw Normal View History

2022-12-21 08:02:43 +00:00
kind: Deployment
apiVersion: apps/v1
metadata:
name: flask-consul
labels:
2022-12-31 06:55:25 +00:00
app: flask-consul
2022-12-21 08:02:43 +00:00
spec:
replicas: 1
selector:
matchLabels:
2022-12-31 06:55:25 +00:00
app: flask-consul
2022-12-21 08:02:43 +00:00
template:
metadata:
labels:
2022-12-31 06:55:25 +00:00
app: flask-consul
2022-12-21 08:02:43 +00:00
spec:
2022-12-31 06:55:25 +00:00
initContainers:
- name: wait-for-consul
image: busybox
command:
- sh
- '-c'
- >-
for i in $(seq 1 60); do nc -z -w3 x.x.x.x 8500 && exit 0 ||
sleep 5; done; exit 1
imagePullPolicy: IfNotPresent
2022-12-21 08:02:43 +00:00
containers:
- name: flask-consul
image: 'swr.cn-south-1.myhuaweicloud.com/starsl.cn/flask-consul:latest'
ports:
- name: http-2026
containerPort: 2026
protocol: TCP
env:
- name: admin_passwd
2022-12-31 06:55:25 +00:00
value: 'xxxxxxxx'
2022-12-21 08:02:43 +00:00
- name: consul_token
2022-12-31 06:55:25 +00:00
value: xxxx-xxxx-xxxx-xxxx
2022-12-21 08:02:43 +00:00
- name: consul_url
2022-12-31 06:55:25 +00:00
value: 'http://x.x.x.x:8500/v1'
2022-12-21 08:02:43 +00:00
- name: log_level
value: INFO
- name: TZ
value: Asia/Shanghai
imagePullPolicy: Always
restartPolicy: Always
---
kind: Service
apiVersion: v1
metadata:
name: flask-consul
labels:
app: flask-consul
spec:
ports:
2022-12-31 06:55:25 +00:00
- name: http-2026
2022-12-21 08:02:43 +00:00
protocol: TCP
port: 2026
targetPort: 2026
selector:
2022-12-31 06:55:25 +00:00
app: flask-consul
2022-12-21 08:02:43 +00:00
type: ClusterIP
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: nginx-consul
labels:
2022-12-31 06:55:25 +00:00
app: nginx-consul
2022-12-21 08:02:43 +00:00
spec:
replicas: 1
selector:
matchLabels:
2022-12-31 06:55:25 +00:00
app: nginx-consul
2022-12-21 08:02:43 +00:00
template:
metadata:
labels:
2022-12-31 06:55:25 +00:00
app: nginx-consul
2022-12-21 08:02:43 +00:00
spec:
containers:
- name: nginx-consul
image: 'swr.cn-south-1.myhuaweicloud.com/starsl.cn/nginx-consul:latest'
ports:
- name: http-1026
containerPort: 1026
protocol: TCP
env:
- name: TZ
value: Asia/Shanghai
imagePullPolicy: Always
restartPolicy: Always
---
kind: Service
apiVersion: v1
metadata:
2022-12-31 06:55:25 +00:00
name: consulmanager
2022-12-21 08:02:43 +00:00
labels:
2022-12-31 06:55:25 +00:00
service: consulmanager
2022-12-21 08:02:43 +00:00
spec:
ports:
- name: nginx-consul
protocol: TCP
port: 1026
targetPort: 1026
2022-12-31 06:55:25 +00:00
nodePort: 31026
2022-12-21 08:02:43 +00:00
selector:
2022-12-31 06:55:25 +00:00
app: nginx-consul
2022-12-21 08:02:43 +00:00
type: NodePort