Skip to content

Commit

Permalink
Enables Calico serviceAccount token monitoring and update of /etc/cni…
Browse files Browse the repository at this point in the history
…/net.d/calico-kubeconfig if need be. (kubernetes-sigs#7586)

Since K8S 1.21, BoundServiceAccountTokenVolume feature gate is in beta stage, thus activated by default (anyone who follows CSI guidelines has enabled AllAlpha and faced the issue before 1.21).
With this feature, SA tokens are regenerated every hour.
As a consequence for Calico CNI, token in /etc/cni/net.d/calico-kubeconfig copied from /var/run/secrets/kubernetes.io/serviceaccount in install-cni initContainer expires after one hour and any pod creation fails due to unauthorization.
Calico pods need to be restarted so that /etc/cni/net.d/calico-kubeconfig is updated with the new SA token.
  • Loading branch information
emiran-orange authored and sakuraiyuta committed Apr 16, 2022
1 parent 97427af commit dac6c39
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions roles/network_plugin/calico/templates/calico-node.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ spec:
value: "true"
- name: FELIX_IGNORELOOSERPF
value: "{{ calico_node_ignorelooserpf }}"
- name: CALICO_MANAGE_CNI
value: "true"
{% if calico_node_extra_envs is defined %}
{% for key in calico_node_extra_envs %}
- name: {{ key }}
Expand Down Expand Up @@ -309,6 +311,8 @@ spec:
- name: xtables-lock
mountPath: /run/xtables.lock
readOnly: false
- mountPath: /host/etc/cni/net.d
name: cni-net-dir
{% if typha_secure %}
- name: typha-client
mountPath: /etc/typha-client
Expand Down

0 comments on commit dac6c39

Please sign in to comment.