-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeployment.yaml
More file actions
127 lines (125 loc) · 3.17 KB
/
deployment.yaml
File metadata and controls
127 lines (125 loc) · 3.17 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
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
kind: Namespace
apiVersion: v1
metadata:
name: wireguard
labels:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
---
kind: Service
apiVersion: v1
metadata:
name: wireguard
namespace: wireguard
labels:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
spec:
type: LoadBalancer
externalTrafficPolicy: Local
ports:
- port: 51820
protocol: UDP
selector:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: wireguard
namespace: wireguard
labels:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
template:
metadata:
labels:
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
spec:
containers:
- name: wireguard
image: docker.io/angoll/wireguard:latest
securityContext:
capabilities:
add:
- NET_ADMIN
- SYS_MODULE
privileged: true
volumeMounts:
- name: configuration
mountPath: /etc/wireguard.conf
subPath: wireguard.conf
readOnly: true
- name: kernel-modules
mountPath: /lib/modules
readOnly: true
ports:
- containerPort: 51820
protocol: UDP
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "200m"
volumes:
- name: configuration
configMap:
name: wireguard-config
- name: kernel-modules
hostPath:
path: /lib/modules
type: Directory
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- wireguard
topologyKey: "kubernetes.io/hostname"
tolerations:
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 5
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 5
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
addonmanager.kubernetes.io/mode: EnsureExists
app.kubernetes.io/name: wireguard
app.kubernetes.io/instance: wireguard
name: wireguard-config
namespace: wireguard
data:
wireguard.conf: |
[Interface]
PrivateKey = <privateIP>
# Address = 10.254.0.1/24 # Set at the entrypoint
[Peer]
PublicKey = <Client1_publicKey>
# PresharedKey = <Client1_preshared> # Optional
AllowedIPs = 10.254.0.2/32 # Wireguard Client IP
PersistentKeepalive = 25
[Peer]
PublicKey = <Client2_publicKey>
# PresharedKey = <Client2_preshared> # Optional
AllowedIPs = 10.254.0.3/32 # Wireguard Client IP
PersistentKeepalive = 20