k8s-bootstrap.yaml
1.46 KB
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
---
apiVersion: v1
kind: ConfigMap
metadata:
name: k8s-bootstrap
namespace: kube-system
data:
clone-start-of-day: |
#!/bin/sh
set -ex
GIT_SSH_COMMAND="ssh -i /tmp/cluster-ssh-key/ssh-private-key"
---
apiVersion: batch/v1
kind: Job
metadata:
name: k8s-bootstrap
namespace: kube-system
spec:
template:
spec:
restartPolicy: OnFailure
securityContext:
runAsUser: 1234
runAsGroup: 1234
fsGroup: 1234
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
volumes:
- name: k8s-bootstrap
configMap:
name: k8s-bootstrap
defaultMode: 0755
- name: git-storage
emptyDir: {}
- name: cluster-ssh-key
secret:
secretName: cluster-ssh-key
defaultMode: 0600
initContainers:
- name: clone-k8s-start-of-day
image: bitnami/git
volumeMounts:
- name: k8s-bootstrap
mountPath: /tmp/k8s-bootstrap
- name: cluster-ssh-key
mountPath: /tmp/cluster-ssh-key
- name: git-storage
mountPath: /tmp/git-storage
command: ["/tmp/k8s-bootstrap/clone-start-of-day"]
containers:
- name: show-status
image: bash
command: ["bash", "-ex", "ls -l /tmp/git-storage"]
volumeMounts:
- name: git-storage
mountPath: /tmp/git-storage
---