Skip to content

Commit 1786a5e

Browse files
committed
kubeadm RBAC fixes and cluster steup with kubeadm instructions
Fixes #115
1 parent e5f24c2 commit 1786a5e

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed

Documentation/kubeadm.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Deploying kube-router with kubeadm
2+
3+
Please follow the [steps](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/) to install Kubernetes cluster with Kubeadm.
4+
5+
6+
For the step #3 **Installing a pod network** install a kube-router pod network and network policy add-on with the following command:
7+
8+
```
9+
kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml
10+
```

daemonset/kubeadm-kuberouter.yaml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: kube-router-cfg
5+
namespace: kube-system
6+
labels:
7+
tier: node
8+
k8s-app: kube-router
9+
data:
10+
cni-conf.json: |
11+
{
12+
"name":"kubernetes",
13+
"type":"bridge",
14+
"bridge":"kube-bridge",
15+
"isDefaultGateway":true,
16+
"ipam": {
17+
"type":"host-local"
18+
}
19+
}
20+
---
21+
apiVersion: extensions/v1beta1
22+
kind: DaemonSet
23+
metadata:
24+
labels:
25+
k8s-app: kube-router
26+
tier: node
27+
name: kube-router
28+
namespace: kube-system
29+
spec:
30+
template:
31+
metadata:
32+
labels:
33+
k8s-app: kube-router
34+
tier: node
35+
annotations:
36+
scheduler.alpha.kubernetes.io/critical-pod: ''
37+
pod.beta.kubernetes.io/init-containers: '[
38+
{
39+
"name": "install-cni",
40+
"image": "busybox",
41+
"command": [ "/bin/sh", "-c", "set -e -x; if [ ! -f /etc/cni/net.d/10-kuberouter.conf ]; then TMP=/etc/cni/net.d/.tmp-kuberouter-cfg; cp /etc/kube-router/cni-conf.json ${TMP}; mv ${TMP} /etc/cni/net.d/10-kuberouter.conf; fi" ],
42+
"volumeMounts": [
43+
{
44+
"name": "cni",
45+
"mountPath": "/etc/cni/net.d"
46+
},
47+
{
48+
"name": "kube-router-cfg",
49+
"mountPath": "/etc/kube-router"
50+
}
51+
],
52+
"volumes": {
53+
"name": "cni",
54+
"hostPath": {
55+
"path": "/etc/cni/net.d"
56+
}
57+
}
58+
}
59+
]'
60+
spec:
61+
serviceAccountName: kube-router
62+
serviceAccount: kube-router
63+
containers:
64+
- name: kube-router
65+
image: cloudnativelabs/kube-router-git
66+
imagePullPolicy: Always
67+
args:
68+
- --run-router=true
69+
- --run-firewall=true
70+
- --run-service-proxy=false
71+
env:
72+
- name: NODE_NAME
73+
valueFrom:
74+
fieldRef:
75+
fieldPath: spec.nodeName
76+
resources:
77+
requests:
78+
cpu: 250m
79+
memory: 250Mi
80+
securityContext:
81+
privileged: true
82+
volumeMounts:
83+
- name: lib-modules
84+
mountPath: /lib/modules
85+
readOnly: true
86+
- name: cni
87+
mountPath: /etc/cni/net.d
88+
- name: kubeconfig
89+
mountPath: /var/lib/kube-router/kubeconfig
90+
readOnly: true
91+
hostNetwork: true
92+
tolerations:
93+
- key: CriticalAddonsOnly
94+
operator: Exists
95+
- effect: NoSchedule
96+
key: node-role.kubernetes.io/master
97+
operator: Exists
98+
volumes:
99+
- hostPath:
100+
path: /lib/modules
101+
name: lib-modules
102+
- hostPath:
103+
path: /etc/cni/net.d
104+
name: cni
105+
- name: kubeconfig
106+
hostPath:
107+
path: /var/lib/kube-router/kubeconfig
108+
- name: kube-router-cfg
109+
configMap:
110+
name: kube-router-cfg
111+
---
112+
apiVersion: v1
113+
kind: ServiceAccount
114+
metadata:
115+
name: kube-router
116+
namespace: kube-system
117+
---
118+
kind: ClusterRole
119+
apiVersion: rbac.authorization.k8s.io/v1beta1
120+
metadata:
121+
name: kube-router
122+
namespace: kube-system
123+
rules:
124+
- apiGroups:
125+
- ""
126+
resources:
127+
- namespaces
128+
- pods
129+
- services
130+
- nodes
131+
- endpoints
132+
verbs:
133+
- list
134+
- get
135+
- watch
136+
- apiGroups:
137+
- "networking.k8s.io"
138+
resources:
139+
- networkpolicies
140+
verbs:
141+
- list
142+
- get
143+
- watch
144+
- apiGroups:
145+
- extensions
146+
resources:
147+
- networkpolicies
148+
verbs:
149+
- get
150+
- list
151+
- watch
152+
---
153+
kind: ClusterRoleBinding
154+
apiVersion: rbac.authorization.k8s.io/v1beta1
155+
metadata:
156+
name: kube-router
157+
roleRef:
158+
apiGroup: rbac.authorization.k8s.io
159+
kind: ClusterRole
160+
name: kube-router
161+
subjects:
162+
- kind: ServiceAccount
163+
name: kube-router
164+
namespace: kube-system

0 commit comments

Comments
 (0)