Skip to content

Commit

Permalink
Enable portmap plugin to fix hostPort with Calico
Browse files Browse the repository at this point in the history
* Ask the Calico sidecar to add a CNI conflist to each node
(for calico and portmap plugins). Cleans up Switch from CNI conf to conflist
* https://github.com/projectcalico/cni-plugin/blob/v1.11.2/k8s-install/scripts/install-cni.sh
* Related kubernetes-retired/bootkube#711
  • Loading branch information
dghubble committed Jan 6, 2018
1 parent 28333ec commit b83e321
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
34 changes: 22 additions & 12 deletions resources/calico/calico-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@ data:
# The CNI network configuration to install on each node.
cni_network_config: |-
{
"name": "k8s-pod-network",
"cniVersion": "0.3.0",
"type": "calico",
"log_level": "info",
"datastore_type": "kubernetes",
"nodename": "__KUBERNETES_NODE_NAME__",
"mtu": ${network_mtu},
"ipam": {
"name": "k8s-pod-network",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "calico",
"log_level": "info",
"datastore_type": "kubernetes",
"nodename": "__KUBERNETES_NODE_NAME__",
"mtu": ${network_mtu},
"ipam": {
"type": "host-local",
"subnet": "usePodCidr"
},
"policy": {
},
"policy": {
"type": "k8s",
"k8s_auth_token": "__SERVICEACCOUNT_TOKEN__"
},
"kubernetes": {
},
"kubernetes": {
"k8s_api_root": "https://__KUBERNETES_SERVICE_HOST__:__KUBERNETES_SERVICE_PORT__",
"kubeconfig": "__KUBECONFIG_FILEPATH__"
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}
2 changes: 2 additions & 0 deletions resources/calico/calico.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
image: ${calico_cni_image}
command: ["/install-cni.sh"]
env:
- name: CNI_CONF_NAME
value: 10-calico.conflist
- name: CNI_NETWORK_CONFIG
valueFrom:
configMapKeyRef:
Expand Down

0 comments on commit b83e321

Please sign in to comment.