-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yaml
120 lines (120 loc) · 2.58 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
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
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: knet-wg
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch
- patch
- update
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: kube-system
name: knet-wg
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: null
name: knet-wg
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: knet-wg
subjects:
- kind: ServiceAccount
name: knet-wg
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kubeconfig
namespace: kube-system
data:
kubeconfig.conf: |
apiVersion: v1
kind: Config
clusters:
- cluster:
certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
# you need to resolve kubernetes to your API server
server: https://kubernetes:6443
name: default
users:
- name: default
user:
tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
contexts:
- context:
cluster: default
namespace: default
user: default
name: default
current-context: default
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: knet-wg
spec:
selector:
matchLabels: { app: knet-wg }
template:
metadata:
labels: { app: knet-wg }
spec:
tolerations:
- operator: "Exists"
effect: "NoSchedule"
serviceAccountName: knet-wg
hostNetwork: true
priorityClassName: system-node-critical
containers:
- name: knet-wg
image: mcluseau/knet-wg
args:
- --key-path=/etc/knet-wg/wg.key
- --kubeconfig=/run/k8s/kubeconfig.conf # to work without kube-proxy, be sure to define the kubernetes host
securityContext:
capabilities:
add:
- NET_ADMIN
volumeMounts:
- name: cni
mountPath: /etc/cni
- name: wg
mountPath: /etc/wireguard
- name: modules
mountPath: /lib/modules
- name: knet-wg
mountPath: /etc/knet-wg
- name: k8s
mountPath: /run/k8s
volumes:
- name: cni
hostPath:
path: /etc/cni
- name: wg
hostPath:
path: /etc/wireguard
- name: modules
hostPath:
path: /lib/modules
- name: knet-wg
hostPath:
path: /var/lib/kubelet/knet-wg
# enable to work with a custom kubeconfig
- name: k8s
configMap:
name: kubeconfig