Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document update #1756

Merged
merged 2 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Documentation/kube-flannel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ apiVersion: v1
metadata:
name: kube-flannel
labels:
k8s-app: flannel
pod-security.kubernetes.io/enforce: privileged
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: flannel
name: flannel
rules:
- apiGroups:
Expand All @@ -32,7 +35,7 @@ rules:
verbs:
- patch
- apiGroups:
- "networking.k8s.io"
- networking.k8s.io
resources:
- clustercidrs
verbs:
Expand All @@ -42,6 +45,8 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: flannel
name: flannel
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -55,6 +60,8 @@ subjects:
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: flannel
name: flannel
namespace: kube-flannel
---
Expand All @@ -65,6 +72,7 @@ metadata:
namespace: kube-flannel
labels:
tier: node
k8s-app: flannel
app: flannel
data:
cni-conf.json: |
Expand Down Expand Up @@ -103,6 +111,7 @@ metadata:
labels:
tier: node
app: flannel
k8s-app: flannel
spec:
selector:
matchLabels:
Expand Down
36 changes: 28 additions & 8 deletions Documentation/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@

Flannel upgrade/downgrade procedure

There are two ways of changing flannel version in the running cluster:
There are different ways of changing flannel version in the running cluster:

*1. Remove old resources definitions and install a new one.*
## Remove old resources definitions and install a new one.
* Pros: Cleanest way of managing resources of the flannel deployment and no manual validation required as long as no additional resources was created by administrators/operators
* Cons: Massive networking outage within a cluster during the version change

To follow that approach one just needs to have a definition of the current version of flannel and the new one. kubectl delete -f <old>.yaml and kubectl create -f <new>.yaml will do the thing

*2. On the fly version*

*1. Delete all the flannel resources using kubectl*
```bash
kubectl -n kube-flannel delete daemonset kube-flannel-ds
kubectl -n kube-flannel delete configmap kube-flannel-cfg
kubectl -n kube-flannel delete serviceaccount flannel
kubectl delete clusterrolebinding.rbac.authorization.k8s.io flannel
kubectl delete clusterrole.rbac.authorization.k8s.io flannel
kubectl delete namespace kube-flannel
```

*2. Install the newer version of flannel and reboot the nodes*

## On the fly version
* Pros: Less disruptive way of changing flannel version, easier to do
* Cons: Some version may have changes which can't be just replaced and may need resources cleanup and/or rename, manual resources comparison required

To do on the fly update both old and new yaml should be compared. Resources in the new yaml with the same name or new ones can be left as is. Resources which exist in old yaml but are missing in the new yaml need to be removed right after the version change. After all of the changes are validated one can just use kubectl create -f <new>.yaml and check that version changed. After that resources which are missing a new applied version can be safely deleted.

If the update is done from newer version as 0.20.2 it can be done using kubectl
```bash
kubectl apply -f /~https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml
```
In case of error on the labeling follow the previous way.

## Using the helm repository

From version 0.21.4 flannel is deployed on an helm repository at `https://flannel-io.github.io/flannel/` it will be possible to manage the update directly with helm.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helm upgrade flannel --set podCidr="10.244.0.0/16" --namespace kube-flannel flannel/flannel

```bash
helm upgrade flannel --set podCidr="10.244.0.0/16" --namespace kube-flannel flannel/flannel
```