|
| 1 | +--- |
| 2 | +# Used for pa.io/blog |
| 3 | +title: 'Fedora 25->26 Atomic Host Upgrade Guide' |
| 4 | +author: dustymabe |
| 5 | +date: 2017-08-03 |
| 6 | +tags: fedora, atomic |
| 7 | +published: false |
| 8 | +--- |
| 9 | + |
| 10 | + |
| 11 | +# Introduction |
| 12 | + |
| 13 | +In July we put out the |
| 14 | +[first](http://www.projectatomic.io/blog/2017/07/fedora-atomic-26-release/) |
| 15 | +and |
| 16 | +[second](http://www.projectatomic.io/blog/2017/07/fedora-atomic-july-25/) |
| 17 | +releases of Fedora 26 Atomic Host. In this blog post we'll cover |
| 18 | +updating an existing Fedora 25 Atomic Host system to Fedora 26. |
| 19 | +We'll cover preparing the system for upgrade and performing the upgrade. |
| 20 | + |
| 21 | +**NOTE:** If you really don't want to upgrade to Fedora 26 see the |
| 22 | + later section: *Appendix B: Fedora 25 Atomic Host Life Support*. |
| 23 | + |
| 24 | +# Preparing for Upgrade |
| 25 | + |
| 26 | +Before we update to Fedora 26 Atomic Host we should check to |
| 27 | +see that we have at least a few GiB of free space in our root |
| 28 | +filesystem. The update to Fedora 26 can cause your system to |
| 29 | +retrieve more than 1GiB of new content (not shared with Fedora |
| 30 | +25) and thus we'll need to make sure we have plenty of free space. |
| 31 | + |
| 32 | +**NOTE:** Upstream OSTree has implemented some |
| 33 | + [filesystem checks](https://github.com/ostreedev/ostree/pull/987) |
| 34 | + to make sure that upgrades will stop themselves before filling up the |
| 35 | + filesystem and possibly corrupting your system. |
| 36 | + |
| 37 | +The system we are upgrading today is a Vagrant box. Let's see how |
| 38 | +much free space we have: |
| 39 | + |
| 40 | +```nohighlight |
| 41 | +[vagrant@host ~]$ sudo df -kh / |
| 42 | +Filesystem Size Used Avail Use% Mounted on |
| 43 | +/dev/mapper/atomicos-root 3.0G 1.4G 1.6G 47% / |
| 44 | +``` |
| 45 | + |
| 46 | +Only `1.6G` free means we probably need to expand our root filesystem |
| 47 | +to make sure we don't run out of space. Let's check to see if we have |
| 48 | +any free space: |
| 49 | + |
| 50 | +```nohighlight |
| 51 | +[vagrant@host ~]$ sudo vgs |
| 52 | + VG #PV #LV #SN Attr VSize VFree |
| 53 | + atomicos 1 2 0 wz--n- 40.70g 22.60g |
| 54 | +[vagrant@host ~]$ sudo lvs |
| 55 | + LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 56 | + docker-pool atomicos twi-a-t--- 15.09g 0.13 0.10 |
| 57 | + root atomicos -wi-ao---- 2.93g |
| 58 | +``` |
| 59 | + |
| 60 | +We can see that we have `22.60g` free and that our `atomicos/root` |
| 61 | +logical volume is `2.93g` in size. We'll go ahead and increase the |
| 62 | +size of the root volume group by 3 GiB. |
| 63 | + |
| 64 | +```nohighlight |
| 65 | +[vagrant@host ~]$ sudo lvresize --size=+3g --resizefs atomicos/root |
| 66 | + Size of logical volume atomicos/root changed from 2.93 GiB (750 extents) to 5.93 GiB (1518 extents). |
| 67 | + Logical volume atomicos/root successfully resized. |
| 68 | +meta-data=/dev/mapper/atomicos-root isize=512 agcount=4, agsize=192000 blks |
| 69 | + = sectsz=512 attr=2, projid32bit=1 |
| 70 | + = crc=1 finobt=1 spinodes=0 rmapbt=0 |
| 71 | + = reflink=0 |
| 72 | +data = bsize=4096 blocks=768000, imaxpct=25 |
| 73 | + = sunit=0 swidth=0 blks |
| 74 | +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 |
| 75 | +log =internal bsize=4096 blocks=2560, version=2 |
| 76 | + = sectsz=512 sunit=0 blks, lazy-count=1 |
| 77 | +realtime =none extsz=4096 blocks=0, rtextents=0 |
| 78 | +data blocks changed from 768000 to 1554432 |
| 79 | +[vagrant@host ~]$ sudo lvs |
| 80 | + LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 81 | + docker-pool atomicos twi-a-t--- 15.09g 0.13 0.10 |
| 82 | + root atomicos -wi-ao---- 5.93g |
| 83 | +``` |
| 84 | + |
| 85 | +As part of that command we also resized the filesystem all in one shot. |
| 86 | +We can see that by checking again the filesystem usage. |
| 87 | + |
| 88 | +```nohighlight |
| 89 | +[vagrant@host ~]$ sudo df -kh / |
| 90 | +Filesystem Size Used Avail Use% Mounted on |
| 91 | +/dev/mapper/atomicos-root 6.0G 1.4G 4.6G 24% / |
| 92 | +``` |
| 93 | + |
| 94 | +# Upgrading |
| 95 | + |
| 96 | +Now we should be ready for the upgrade. If you are hosting any services |
| 97 | +on your instance you may want to prepare for them to have some downtime. |
| 98 | + |
| 99 | +**NOTE:** If you are running Kubernetes you should check out the later |
| 100 | + section on Kubernetes: *Appendix A: Upgrading Systems with |
| 101 | + Kubernetes*. |
| 102 | + |
| 103 | +**NOTE:** If you are running OpenShift Origin (i.e. via being set up |
| 104 | + by the |
| 105 | + [openshift-ansible installer](http://www.projectatomic.io/blog/2016/12/part1-install-origin-on-f25-atomic-host/)) |
| 106 | + the upgrade should not need any preparation. |
| 107 | + |
| 108 | +Currently we are on Fedora 25 Atomic Host using the |
| 109 | +`fedora-atomic/25/x86_64/docker-host` ref. |
| 110 | + |
| 111 | +```nohighlight |
| 112 | +[vagrant@host ~]$ rpm-ostree status |
| 113 | +State: idle |
| 114 | +Deployments: |
| 115 | +● fedora-atomic:fedora-atomic/25/x86_64/docker-host |
| 116 | + Version: 25.154 (2017-07-04 01:38:10) |
| 117 | + Commit: ce555fa89da934e6eef23764fb40e8333234b8b60b6f688222247c958e5ebd5b |
| 118 | +``` |
| 119 | + |
| 120 | + |
| 121 | +In order to do the upgrade we need to add the location of |
| 122 | +the Fedora 26 repository as a new remote (similar to a |
| 123 | +git remote) for `ostree` to know about: |
| 124 | + |
| 125 | +```nohighlight |
| 126 | +[vagrant@host ~]$ sudo ostree remote add --set=gpgkeypath=/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-26-primary fedora-atomic-26 https://kojipkgs.fedoraproject.org/atomic/26 |
| 127 | +``` |
| 128 | +You can see from the command that we are adding a new remote known as |
| 129 | +`fedora-atomic-26` with a remote url of `https://kojipkgs.fedoraproject.org/atomic/26`. |
| 130 | +We are also setting the `gpgkeypath` variable in the configuration for |
| 131 | +the remote. This tells OSTree that we want commit signatures to be |
| 132 | +verified when we download from a remote. This is something new that was |
| 133 | +enabled for Fedora 26 Atomic Host. |
| 134 | + |
| 135 | +Now that we have our `fedora-atomic-26` remote we can do the upgrade! |
| 136 | + |
| 137 | +```nohighlight |
| 138 | +[vagrant@host ~]$ sudo rpm-ostree rebase fedora-atomic-26:fedora/26/x86_64/atomic-host |
| 139 | +
|
| 140 | +Receiving metadata objects: 0/(estimating) -/s 0 bytes |
| 141 | +Signature made Sun 23 Jul 2017 03:13:09 AM UTC using RSA key ID 812A6B4B64DAB85D |
| 142 | + Good signature from "Fedora 26 Primary <fedora-26-primary@fedoraproject.org>" |
| 143 | +
|
| 144 | +Receiving delta parts: 0/27 5.3 MB/s 26.7 MB/355.4 MB |
| 145 | +Signature made Sun 23 Jul 2017 03:13:09 AM UTC using RSA key ID 812A6B4B64DAB85D |
| 146 | + Good signature from "Fedora 26 Primary <fedora-26-primary@fedoraproject.org>" |
| 147 | +
|
| 148 | +27 delta parts, 9 loose fetched; 347079 KiB transferred in 105 seconds |
| 149 | +Copying /etc changes: 22 modified, 0 removed, 58 added |
| 150 | +Transaction complete; bootconfig swap: yes deployment count change: 1 |
| 151 | +Upgraded: |
| 152 | + GeoIP 1.6.11-1.fc25 -> 1.6.11-1.fc26 |
| 153 | + GeoIP-GeoLite-data 2017.04-1.fc25 -> 2017.06-1.fc26 |
| 154 | + NetworkManager 1:1.4.4-5.fc25 -> 1:1.8.2-1.fc26 |
| 155 | + ... |
| 156 | + ... |
| 157 | + setools-python-4.1.0-3.fc26.x86_64 |
| 158 | + setools-python3-4.1.0-3.fc26.x86_64 |
| 159 | +Run "systemctl reboot" to start a reboot |
| 160 | +[vagrant@host ~]$ sudo reboot |
| 161 | +Connection to 192.168.121.217 closed by remote host. |
| 162 | +Connection to 192.168.121.217 closed. |
| 163 | +``` |
| 164 | + |
| 165 | +After reboot we can log in and see the status: |
| 166 | + |
| 167 | +```nohighlight |
| 168 | +$ vagrant ssh |
| 169 | +[vagrant@host ~]$ rpm-ostree status |
| 170 | +State: idle |
| 171 | +Deployments: |
| 172 | +● fedora-atomic-26:fedora/26/x86_64/atomic-host |
| 173 | + Version: 26.91 (2017-07-23 03:12:08) |
| 174 | + Commit: 0715ce81064c30d34ed52ef811a3ad5e5d6a34da980bf35b19312489b32d9b83 |
| 175 | + GPGSignature: 1 signature |
| 176 | + Signature made Sun 23 Jul 2017 03:13:09 AM UTC using RSA key ID 812A6B4B64DAB85D |
| 177 | + Good signature from "Fedora 26 Primary <fedora-26-primary@fedoraproject.org>" |
| 178 | +
|
| 179 | + fedora-atomic:fedora-atomic/25/x86_64/docker-host |
| 180 | + Version: 25.154 (2017-07-04 01:38:10) |
| 181 | + Commit: ce555fa89da934e6eef23764fb40e8333234b8b60b6f688222247c958e5ebd5b |
| 182 | +[vagrant@host ~]$ cat /etc/fedora-release |
| 183 | +Fedora release 26 (Twenty Six) |
| 184 | +``` |
| 185 | + |
| 186 | +We are now on Fedora 26 Atomic Host. Now is a good time to check your |
| 187 | +services (most likely running in containers) to see if they are still |
| 188 | +working. If not, then you always have the rollback command: `sudo |
| 189 | +rpm-ostree rollback`. |
| 190 | + |
| 191 | +**NOTE:** Over time you can see updated commands for upgrading Atomic |
| 192 | + Host between releases by visiting [this](https://fedoraproject.org/wiki/Atomic_Host_upgrade) |
| 193 | + wiki page. |
| 194 | + |
| 195 | +# Appendix A: Upgrading Systems with Kubernetes |
| 196 | + |
| 197 | +Fedora 25 Atomic Host ships with Kubernetes **v1.5.3**, and Fedora 26 |
| 198 | +Atomic Host ships with Kubernetes **v1.6.7**. **Before** upgrading systems |
| 199 | +participating in an existing Kubernetes cluster from 25 to 26, there |
| 200 | +are a few configuration changes to make. |
| 201 | + |
| 202 | +## Node Servers |
| 203 | + |
| 204 | +In Kubernetes 1.6, the `--config` argument is no longer valid. If |
| 205 | +your `KUBELET_ARGS` in `/etc/kubernetes/kubelet` point to the manifests |
| 206 | +directory using the `--config` argument, then you need to change |
| 207 | +the argument name to `--pod-manifest-path`. Also in `KUBELET_ARGS`, you |
| 208 | +need to add the argument `--cgroup-driver=systemd`. |
| 209 | + |
| 210 | +For example, if your `/etc/kubernetes/kubelet` file starts with the |
| 211 | +following: |
| 212 | + |
| 213 | +```nohighlight |
| 214 | +KUBELET_ARGS="--kubeconfig=/etc/kubernetes/kubelet.kubeconfig --config=/etc/kubernetes/manifests --cluster-dns=10.254.0.10 --cluster-domain=cluster.local" |
| 215 | +``` |
| 216 | + |
| 217 | +Then it should be changed to be: |
| 218 | + |
| 219 | +```nohighlight |
| 220 | +KUBELET_ARGS="--kubeconfig=/etc/kubernetes/kubelet.kubeconfig --pod-manifest-path=/etc/kubernetes/manifests --cluster-dns=10.254.0.10 --cluster-domain=cluster.local --cgroup-driver=systemd" |
| 221 | +``` |
| 222 | + |
| 223 | +## Master Servers |
| 224 | + |
| 225 | +### Staying With etcd2 |
| 226 | + |
| 227 | +From Kubernetes 1.5 to 1.6 upstream |
| 228 | +[shifted](https://kubernetes.io/docs/tasks/administer-cluster/upgrade-1-6/) |
| 229 | +from using version 2 of the etcd API to version 3. The |
| 230 | +[Kubernetes documentation](https://github.com/kubernetes/kubernetes/blob/93b144c/CHANGELOG.md#internal-storage-layer-1) |
| 231 | +instructs users to **add** two arguments to the `KUBE_API_ARGS` variable |
| 232 | +in the `/etc/kubernetes/apiserver` file: |
| 233 | + |
| 234 | +```nohighlight |
| 235 | +--storage-backend=etcd2 --storage-media-type=application/json |
| 236 | +``` |
| 237 | + |
| 238 | +This will ensure that any pods, services or other objects stored in etcd |
| 239 | +will continue to be found by Kubernetes once you've completed your upgrade. |
| 240 | + |
| 241 | +### Moving To etcd3 |
| 242 | + |
| 243 | +If you later wish to migrate your etcd data to the v3 API, stop your |
| 244 | +etcd and kube-apiserver services and, run the following command to |
| 245 | +migrate to etcd3: |
| 246 | + |
| 247 | +**NOTE:** The following command assumes your data is stored in |
| 248 | + `/var/lib/etcd`. |
| 249 | + |
| 250 | + |
| 251 | +```nohighlight |
| 252 | +# ETCDCTL_API=3 etcdctl --endpoints https://YOUR-ETCD-IP:2379 migrate --data-dir=/var/lib/etcd |
| 253 | +``` |
| 254 | + |
| 255 | +Then remove the `--storage-backend=etcd2` and `--storage-media-type=application/json` |
| 256 | +arguments from the `/etc/kubernetes/apiserver` file and restart the etcd |
| 257 | +and kube-apiserver services. |
| 258 | + |
| 259 | + |
| 260 | +# Appendix B: Fedora 25 Atomic Host Life Support |
| 261 | + |
| 262 | +We have [decided](https://pagure.io/atomic-wg/issue/303) |
| 263 | +to keep updating the `fedora-atomic/25/x86_64/docker-host` |
| 264 | +ref every day when Bodhi runs within Fedora. A new update will |
| 265 | +get created every day. However, we recommend you upgrade to Fedora 26, |
| 266 | +because we are focusing future testing and development efforts on on |
| 267 | +Fedora 26 Atomic Host and thus the Fedora 25 OSTrees don't get |
| 268 | +tested. |
| 269 | + |
| 270 | + |
| 271 | +# Conclusion |
| 272 | + |
| 273 | +The transition to Fedora 26 Atomic Host should be a smooth process. |
| 274 | +If you have issues or want to be involved in the future direction of Atomic |
| 275 | +Host please join us in IRC (#atomic on |
| 276 | +[freenode](https://freenode.net/)) |
| 277 | +or on the [atomic-devel](https://lists.projectatomic.io/mailman/listinfo/atomic-devel) |
| 278 | +mailing list. |
0 commit comments