mirror of https://github.com/easzlab/kubeasz.git
fix:多网卡安装flannel问题
parent
3bf3908d3a
commit
44a3bb4072
|
@ -64,20 +64,24 @@ FLANNEL_IPMASQ=true
|
|||
+ 配置`ConfigMap`包含 CNI配置和 flannel配置(指定backend等),和`hosts`文件中相关设置对应
|
||||
+ `DaemonSet Pod`包含两个容器,一个容器运行flannel本身,另一个init容器部署cni 配置文件
|
||||
+ 为方便国内加速使用镜像 `jmgao1983/flannel:v0.10.0-amd64` (官方镜像在docker-hub上的转存)
|
||||
+ 特别注意:如果服务器是多网卡(例如vagrant环境),则需要在`roles/flannel/templates/kube-flannel.yaml.j2 `中增加指定的外网出口的网卡,例如:
|
||||
+ 特别注意:如果服务器是多网卡(例如vagrant环境),则需要在`roles/flannel/templates/kube-flannel.yaml.j2 `中增加指定环境变量,详见 [kubernetes ISSUE 39701](https://github.com/kubernetes/kubernetes/issues/39701)
|
||||
|
||||
``` bash
|
||||
...
|
||||
containers:
|
||||
- name: kube-flannel
|
||||
image: quay.io/coreos/flannel:v0.10.0-amd64
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
args:
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
#- --iface=eth1 多网卡需要去掉注释,指定外网出口网卡
|
||||
...
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: KUBERNETES_SERVICE_HOST # 指定apiserver的主机地址
|
||||
value: {{ MASTER_IP }}
|
||||
- name: KUBERNETES_SERVICE_PORT # 指定apiserver的服务端口
|
||||
value: {{ KUBE_APISERVER.split(':')[2] }}
|
||||
...
|
||||
```
|
||||
### 安装 flannel网络
|
||||
|
||||
|
|
|
@ -145,6 +145,11 @@ spec:
|
|||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ MASTER_IP }}
|
||||
#value: {{ KUBE_APISERVER.split(':')[1].lstrip('/') }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ KUBE_APISERVER.split(':')[2] }}
|
||||
volumeMounts:
|
||||
- name: run
|
||||
mountPath: /run
|
||||
|
|
Loading…
Reference in New Issue