|
| 1 | +# Upgrading kube-router |
| 2 | + |
| 3 | +## Breaking Changes |
| 4 | + |
| 5 | +We follow semantic versioning and try to the best of our abilities to maintain a |
| 6 | +stable interface between patch versions. For example, `v0.1.1` -> `v0.1.2` |
| 7 | +should be a perfectly safe upgrade path, without data service interruption. |
| 8 | +However, major (`vX.0.0`) and minor (`v0.Y.0`) version upgrades may contain |
| 9 | +breaking changes, which will be detailed here and in the release notes. |
| 10 | + |
| 11 | +First check if you are upgrading across one of the |
| 12 | +[breaking change versions](#breaking-change-version-history). If so, read the |
| 13 | +relevant section(s) first before proceeding with the general guidelines below. |
| 14 | + |
| 15 | +## General Guidelines |
| 16 | + |
| 17 | +### Image Pull Policy |
| 18 | +Here we will assume that you have the following in your kube-router DaemonSet: |
| 19 | +```yaml |
| 20 | +imagePullPolicy: Always |
| 21 | +``` |
| 22 | +
|
| 23 | +If that's not the case, you will need to manually pull the desired image version |
| 24 | +on each of your nodes with a command like: `docker pull |
| 25 | +cloudnativelabs/kube-router:VERSION` |
| 26 | + |
| 27 | +### Without Rolling Updates |
| 28 | + |
| 29 | +This is the default situation with our DaemonSet manifests. We will soon be |
| 30 | +switching these manifests to use Rolling Updates though. |
| 31 | + |
| 32 | +The following example(s) show an upgrade from `v0.0.15` to `v0.0.16`. |
| 33 | + |
| 34 | +First we will modify the kube-router DaemonSet resource's image field: |
| 35 | +``` |
| 36 | +kubectl -n kube-system set image ds/kube-router kube-router=cloudnativelabs/kube-router:v0.0.16 |
| 37 | +``` |
| 38 | + |
| 39 | +This does not actually trigger any version changes yet. It is recommended that |
| 40 | +you upgrade only one node and perform any tests you see fit to ensure nothing |
| 41 | +goes wrong. |
| 42 | + |
| 43 | +For example, we'll test upgrading kube-router on worker-01: |
| 44 | +```sh |
| 45 | +TEST_NODE="worker-01" |
| 46 | +TEST_POD="$(kubectl -n kube-system get pods -o wide|grep -E "^kube-router.*${TEST_NODE}"|awk '{ print $1 }') |
| 47 | +
|
| 48 | +kubectl -n kube-system delete pod "${TEST_POD}" |
| 49 | +``` |
| 50 | + |
| 51 | +You can watch to make sure the new kube-router pod comes up and stays running |
| 52 | +with: |
| 53 | +```sh |
| 54 | +kubectl -n kube-system get pods -o wide -w |
| 55 | +``` |
| 56 | + |
| 57 | +Check the logs with: |
| 58 | +```sh |
| 59 | +TEST_NODE="worker-01" |
| 60 | +TEST_POD="$(kubectl -n kube-system get pods -o wide|grep -E "^kube-router.*${TEST_NODE}"|awk '{ print $1 }') |
| 61 | +
|
| 62 | +kubectl -n kube-system logs "${TEST_POD}" |
| 63 | +``` |
| 64 | + |
| 65 | +If it all looks good, go ahead and upgrade kube-router on all nodes: |
| 66 | +```sh |
| 67 | +kubectl -n kube-system delete pods -l k8s-app=kube-router |
| 68 | +``` |
| 69 | + |
| 70 | +### With Rolling Updates |
| 71 | + |
| 72 | +*TODO* |
| 73 | + |
| 74 | +## Breaking Change Version History |
| 75 | + |
| 76 | +This section covers version specific upgrade instructions. |
| 77 | + |
| 78 | +### v0.0.X alpha versions |
| 79 | + |
| 80 | +While kube-router is in its alpha stage changes can be expected to be rapid. |
| 81 | +Therefor we cannot guarantee that a new alpha release will not break previous |
| 82 | +expected behavior. |
| 83 | + |
| 84 | +### v0.0.17 (aka v0.1.0-rc1) |
| 85 | + |
| 86 | +This version brings changes to hairpin and BGP peering CLI/annotation |
| 87 | +configuration flags/keys. |
| 88 | + |
| 89 | +CLI flag changes: |
| 90 | +- OLD: `--peer-router` -> NEW: `--peer-router-ips` |
| 91 | +- OLD: `--peer-asn` -> NEW: `--peer-router-asns` |
| 92 | + |
| 93 | +CLI flag additions: |
| 94 | +- NEW: `--peer-router-passwords` |
| 95 | + |
| 96 | +Annotation key changes: |
| 97 | +- OLD: `kube-router.io/hairpin-mode=` -> NEW: |
| 98 | + `io.kube-router.net.service.hairpin=` |
| 99 | +- OLD: `net.kuberouter.nodeasn=` -> NEW: `io.kube-router.net.node.asn=` |
| 100 | +- OLD: `net.kuberouter.node.bgppeer.address=` -> NEW: `io.kube-router.net.peer.ips` |
| 101 | +- OLD: `net.kuberouter.node.bgppeer.asn` -> NEW: `io.kube-router.net.peer.asns` |
| 102 | + |
| 103 | +Annotation key additions: |
| 104 | +- NEW: `io.kube-router.net.peer.passwords` |
| 105 | + |
| 106 | +#### v0.0.17 Upgrade Procedure |
| 107 | + |
| 108 | +For CLI flag changes, all that is required is to change the flag names you use |
| 109 | +above to their new names at the same time that you change the image version. |
| 110 | +``` |
| 111 | +kubectl -n kube-system edit ds kube-router |
| 112 | +``` |
| 113 | +
|
| 114 | +For Annotations, the recommended approach is to copy all the values of |
| 115 | +your current annotations into new annotations with the updated keys. |
| 116 | +
|
| 117 | +You can get a quick look at all your service and node annotations with these |
| 118 | +commands: |
| 119 | +```sh |
| 120 | +kubectl describe services --all-namespaces |grep -E '^(Name:|Annotations:)' |
| 121 | +kubectl describe nodes |grep -E '^(Name:|Annotations:)' |
| 122 | +``` |
| 123 | + |
| 124 | +For example if you have a service annotation to enable Hairpin mode like: |
| 125 | +``` |
| 126 | +Name: hairpin-service |
| 127 | +Annotations: kube-router.io/hairpin-mode= |
| 128 | +``` |
| 129 | + |
| 130 | +You will then want to make a new annotation with the new key: |
| 131 | +```sh |
| 132 | +kubectl annotate service hairpin-service "io.kube-router.net.service.hairpin=" |
| 133 | +``` |
| 134 | + |
| 135 | +Once all new annotations are created, proceed with the |
| 136 | +[General Guidelines](#general-guidelines). After the upgrades tested and |
| 137 | +complete, you can delete the old annotations. |
| 138 | +```sh |
| 139 | +kubectl annotate service hairpin-service "kube-router.io/hairpin-mode-" |
| 140 | +``` |
0 commit comments