diff --git a/README.md b/README.md index 87f1b31..76a5c2c 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ - 启动:`docker-compose pull && docker-compose up -d` - 访问:`http://{IP}:1026`,使用配置的变量 **`admin_passwd`** 登录 +##### k8s部署 +###### 1.创建命名空间 +- `kubectl create namespace` +###### 1.部署consulmanager +- `kubectl apply -f consulmanager.yaml` + ## 📌[更新记录](https://github.com/starsliao/ConsulManager/releases) ## 🎨截图预览([点击查看完整截图](https://github.com/starsliao/ConsulManager/tree/main/screenshot#%E6%88%AA%E5%9B%BE)) diff --git a/consulmanager.yaml b/consulmanager.yaml new file mode 100644 index 0000000..1d331b5 --- /dev/null +++ b/consulmanager.yaml @@ -0,0 +1,109 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: flask-consul + namespace: consulmanager + labels: + service: flask-consul +spec: + replicas: 1 + selector: + matchLabels: + service: flask-consul + template: + metadata: + labels: + service: flask-consul + spec: + 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 + value: Admin@123 + - name: consul_token + value: 27f38cb5-76b1-11dd-ba75-85d6aae1647e + - name: consul_url + value: 'http://192.168.31.150:8500/v1' + - name: log_level + value: INFO + - name: TZ + value: Asia/Shanghai + imagePullPolicy: Always + restartPolicy: Always +--- +kind: Service +apiVersion: v1 +metadata: + name: flask-consul + namespace: consulmanager + labels: + app: flask-consul +spec: + ports: + - name: http-2060 + protocol: TCP + port: 2026 + targetPort: 2026 + selector: + service: flask-consul + type: ClusterIP +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: nginx-consul + namespace: consulmanager + labels: + service: nginx-consul +spec: + replicas: 1 + selector: + matchLabels: + service: nginx-consul + template: + metadata: + labels: + service: nginx-consul + 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 + resources: + limits: + cpu: '1' + memory: 1Gi + requests: + cpu: '1' + memory: 1Gi + imagePullPolicy: Always + restartPolicy: Always +--- +kind: Service +apiVersion: v1 +metadata: + name: nginx-consul + namespace: consulmanager + labels: + service: nginx-consul +spec: + ports: + - name: nginx-consul + protocol: TCP + port: 1026 + targetPort: 1026 + nodePort: 31800 + selector: + service: nginx-consul + type: NodePort \ No newline at end of file