mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善k8s文件
This commit is contained in:
@@ -2,6 +2,8 @@ resources:
|
|||||||
- api.yaml
|
- api.yaml
|
||||||
- redis.yaml
|
- redis.yaml
|
||||||
- pg.yaml
|
- pg.yaml
|
||||||
|
- ns.yaml
|
||||||
|
- nginx.yaml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
73
k8s/base/nginx.yaml
Normal file
73
k8s/base/nginx.yaml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: nginx
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 8000
|
||||||
|
type: NodePort
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: nginx-conf
|
||||||
|
data:
|
||||||
|
default.conf: |
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxypass http://coal-ui:7456/;
|
||||||
|
}
|
||||||
|
location /api {
|
||||||
|
proxypass http://coal-api:7456/;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nginx
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/nginx/conf.d/default.conf
|
||||||
|
name: nginx-conf
|
||||||
|
subPath: default.conf
|
||||||
|
restartPolicy: Always
|
||||||
|
volumes:
|
||||||
|
- name: nginx-conf
|
||||||
|
configMap:
|
||||||
|
items:
|
||||||
|
- key: default.conf
|
||||||
|
path: default.conf
|
||||||
4
k8s/base/ns.yaml
Normal file
4
k8s/base/ns.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: coal
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
|
|
||||||
namespace: coal
|
namespace: coal-master
|
||||||
|
|
||||||
images:
|
images:
|
||||||
- name: redis
|
- name: redis
|
||||||
@@ -14,10 +14,48 @@ images:
|
|||||||
|
|
||||||
commonLabels:
|
commonLabels:
|
||||||
branch: master
|
branch: master
|
||||||
nameSuffix: -master
|
|
||||||
|
|
||||||
|
|
||||||
patchesStrategicMerge:
|
patchesStrategicMerge:
|
||||||
|
- |
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: nginx
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: nginx
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 8000
|
||||||
|
type: NodePort
|
||||||
|
- |
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: nginx-conf
|
||||||
|
data:
|
||||||
|
default.conf: |
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxypass http://coal-ui.coal-master.svc.cluster.local:80/;
|
||||||
|
}
|
||||||
|
location /api {
|
||||||
|
proxypass http://coal-api.coal-master.svc.cluster.local:7456/;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -30,8 +68,8 @@ patchesStrategicMerge:
|
|||||||
- name: coal-api
|
- name: coal-api
|
||||||
env:
|
env:
|
||||||
- name: PG_HOST
|
- name: PG_HOST
|
||||||
value: "pg-master.coal.svc.cluster.local"
|
value: "pg.coal-master.svc.cluster.local"
|
||||||
- name: REDIS_HOST
|
- name: REDIS_HOST
|
||||||
value: "redis-master.coal.svc.cluster.local"
|
value: "redis.coal-master.coal.svc.cluster.local"
|
||||||
- name: SPRING_PROFILES_ACTIVE
|
- name: SPRING_PROFILES_ACTIVE
|
||||||
value: "master"
|
value: "master"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
|
|
||||||
namespace: coal
|
namespace: coal-test
|
||||||
|
|
||||||
images:
|
images:
|
||||||
- name: redis
|
- name: redis
|
||||||
@@ -14,25 +14,24 @@ images:
|
|||||||
|
|
||||||
commonLabels:
|
commonLabels:
|
||||||
branch: test
|
branch: test
|
||||||
nameSuffix: -test
|
|
||||||
|
|
||||||
|
|
||||||
replacements:
|
patchesStrategicMerge:
|
||||||
- source:
|
|
||||||
kind: Service
|
- |
|
||||||
name: pg-test
|
apiVersion: apps/v1
|
||||||
targets:
|
kind: Deployment
|
||||||
- select:
|
metadata:
|
||||||
kind: Deployment
|
name: coal-api
|
||||||
name: coal-api
|
spec:
|
||||||
fieldPaths:
|
template:
|
||||||
- spec.template.spec.containers.[name=coal-api].env.[name=PG_HOST].value
|
spec:
|
||||||
- source:
|
containers:
|
||||||
kind: Service
|
- name: coal-api
|
||||||
name: redis-test
|
env:
|
||||||
targets:
|
- name: PG_HOST
|
||||||
- select:
|
value: "pg.coal-test.svc.cluster.local"
|
||||||
kind: Deployment
|
- name: REDIS_HOST
|
||||||
name: coal-api
|
value: "redis.coal-test.coal.svc.cluster.local"
|
||||||
fieldPaths:
|
- name: SPRING_PROFILES_ACTIVE
|
||||||
- spec.template.spec.containers.[name=coal-api].env.[name=REDIS_HOST].value
|
value: "test"
|
||||||
|
|||||||
Reference in New Issue
Block a user