This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
kubernetes.yaml
133 lines (129 loc) · 3.19 KB
/
kubernetes.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubeedge-database
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeedge-database
labels:
k8s-app: kubeedge
kubeedge: kubeedge-database
rules:
- apiGroups:
- "devices.kubeedge.io"
resources:
- devices
- devicemodels
verbs:
- watch
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeedge-database
labels:
k8s-app: kubeedge
kubeedge: kubeedge-database
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeedge-database
subjects:
- kind: ServiceAccount
name: kubeedge-database
namespace: default
---
apiVersion: v1
kind: Secret
metadata:
name: kubeedge-database-database
type: Opaque
stringData:
user: demo
password: test-password
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: kubeedge
kubeedge: kubeedge-database
name: kubeedge-database
spec:
selector:
matchLabels:
k8s-app: kubeedge
kubeedge: kubeedge-database
template:
metadata:
labels:
k8s-app: kubeedge
kubeedge: kubeedge-database
spec:
initContainers:
- name: kubeconfig
image: alpine:3.10
volumeMounts:
- mountPath: /etc/kubeedge-database/conf
subPath: kubeconfig.yaml
name: kubeconfig
command:
- /bin/sh
- -c
- |
tee /etc/kubeedge-database/conf/kubeconfig.yaml <<EOF
apiVersion: v1
kind: Config
clusters:
- name: kubeedge-database
cluster:
certificate-authority: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
users:
- name: kubeedge-database
user:
token: $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
contexts:
- name: kubeedge
context:
cluster: kubeedge-database
user: kubeedge-database
current-context: kubeedge
EOF
containers:
- name: kubeedge-database
image: subpathdev/kubeedge-database:v0.0.2
imagePullPolicy: Always
env:
- name: DATABASE-USER
valueFrom:
secretKeyRef:
key: user
name: kubeedge-database-database
- name: DATABASE-PASSWORD
valueFrom:
secretKeyRef:
key: password
name: kubeedge-database-database
args:
- "--config=/etc/kubeedge-database/conf/kubeconfig.yaml"
- "--database=demo"
- "--address=timescale.default.svc.cluster.local"
- "--port=5432"
- "--sslmode=disable"
- "--schema=public"
- "--timescale"
volumeMounts:
- mountPath: /etc/kubeedge-database/conf
name: kubeconfig
subPath: kubeconfig.yaml
volumes:
- name: kubeconfig
emptyDir: {}
restartPolicy: Always
serviceAccount: kubeedge-database
serviceAccountName: kubeedge-database