-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy.yaml
82 lines (79 loc) · 1.94 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
apiVersion: apps/v1
kind: Deployment
metadata:
name: codo-cmdb
spec:
replicas: 1
selector:
matchLabels:
app: codo-cmdb
template:
metadata:
labels:
app: codo-cmdb
spec:
containers:
- name: codo-cmdb
image: harbor-k8s.shinezone.com/ops/codo-cmdb:<BUILD_TAG>
imagePullPolicy: IfNotPresent
# lifecycle:
# postStart:
# exec:
# command: ['/bin/sh', '-c', 'sed -i "s/s_hostname/$(hostname)/" /data1/www/templates/app.html']
resources:
limits:
cpu: 0.5
memory: 512Mi
requests:
cpu: 0.3
memory: 256Mi
ports:
- name: http
containerPort: 80
volumeMounts:
- name: cmdbconf
mountPath: /var/www/CMDB/cmdb.conf
subPath: cmdb.conf #以文件的形式挂载
readOnly: true
- name: cmdbnginx
mountPath: /etc/nginx/conf.d/
volumes:
- name: cmdbconf
configMap:
name: cmdb-conf #configmap要提前创建好 kubectl create configmap cmdb-conf --from-file=./cmdb.conf -n qa
- name: cmdbnginx
configMap:
name: cmdb-nginx-conf # kubectl create configmap cmdb-nginx-conf --from-file=./nginx_cmdb.conf -n qa
---
apiVersion: v1
kind: Service
metadata:
name: codo-cmdb #k8s内网对应的域名为 codo-cmdb.qa.svc.cluster.local
labels:
app: codo-cmdb
spec:
selector:
app: codo-cmdb
#type: NodePort
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 80
---
# api不需要通过ingress反代到外网
#apiVersion: extensions/v1beta1
#kind: Ingress
#metadata:
# name: codo-cmdb-ingress
# annotations:
# kubernetes.io/ingress.class: "traefik"
#spec:
# rules:
# - host: <DOMAIN>
# http:
# paths:
# - path:
# backend:
# serviceName: codo-cmdb
# servicePort: 80