Skip to content

Instantly share code, notes, and snippets.

@jmarhee
Last active January 4, 2022 22:27
Show Gist options
  • Save jmarhee/bb99adef85db20c3c0237038f4e72286 to your computer and use it in GitHub Desktop.
Save jmarhee/bb99adef85db20c3c0237038f4e72286 to your computer and use it in GitHub Desktop.
[Installing Canal](https://projectcalico.docs.tigera.io/getting-started/kubernetes/flannel/flannel) requires updating a `CALICO_IPV4POOL_CIDR` environment variable in the installation manifest for use with K3s, which has a default Pod CIDR of "10.44.0.0/24"-- this will modify the manifest to reflect the current Pod CIDR.
## Applies the modified manifest to K3s, which automatically applies the contents of /var/lib/rancher/k3s/server/manifests
curl -s https://docs.projectcalico.org/manifests/canal.yaml | sed -e 's| # - name: CALICO_IPV4POOL_CIDR| - name: CALICO_IPV4POOL_CIDR|g' -e "s| # value: \"192.168.0.0/16\"| value: \"$(kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}')\"|g" | \
tee -a /var/lib/rancher/k3s/server/manifests/canal.yaml
curl -s https://docs.projectcalico.org/manifests/canal.yaml | \
sed \
-e 's| # - name: CALICO_IPV4POOL_CIDR| - name: CALICO_IPV4POOL_CIDR|g' \
-e "s| # value: \"192.168.0.0/16\"| value: \"$(kubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}')\"|g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment