-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmihomo-deployment.yaml
73 lines (73 loc) · 1.92 KB
/
mihomo-deployment.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
apiVersion: apps/v1
kind: Deployment
metadata:
name: mihomo-deployment
namespace: mihomo
spec:
replicas: 1
selector:
matchLabels:
app: mihomo
template:
metadata:
labels:
app: mihomo
# Use annotation to specify the network interface
annotations:
k8s.v1.cni.cncf.io/networks: 'mihomo-home-lan'
spec:
# User nodeselector if needed
nodeName: master
containers:
- name: mihomo
image: metacubex/mihomo:Alpha
imagePullPolicy: IfNotPresent
# This will execute the script to configure iptables after mihomo starts up
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "/root/iptables.sh"]
securityContext:
privileged: true
capabilities:
add: ["NET_ADMIN"]
resources:
limits:
cpu: "1000m"
memory: 512Mi
requests:
cpu: "250m"
memory: 256Mi
env:
- name: TZ
value: Asia/Shanghai
ports:
- containerPort: 53
name: dns
- containerPort: 7890
name: mixed-port
- containerPort: 9999
name: api
- containerPort: 7893
name: tproxy-port
volumeMounts:
- name: mihomo-config
mountPath: /root/.config/mihomo/config.yaml
subPath: config.yaml
- name: mihomo-volume
mountPath: /root/.config/mihomo
- name: iptables
mountPath: /root/iptables.sh
subPath: iptables.sh
volumes:
- name: mihomo-volume
hostPath:
path: /root/mihomo
- name: mihomo-config
configMap:
name: mihomo-config
- name: iptables
configMap:
name: mihomo-iptables
# This will change the iptables.sh file mode to 755, so that it can be executed by root user
defaultMode: 0744