You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.1 KiB

  1. Upgrading Kubernetes in Kubespray
  2. =============================
  3. #### Description
  4. Kubespray handles upgrades the same way it handles initial deployment. That is to
  5. say that each component is laid down in a fixed order. You should be able to
  6. upgrade from Kubespray tag 2.0 up to the current master without difficulty. You can
  7. also individually control versions of components by explicitly defining their
  8. versions. Here are all version vars for each component:
  9. * docker_version
  10. * kube_version
  11. * etcd_version
  12. * calico_version
  13. * calico_cni_version
  14. * weave_version
  15. * flannel_version
  16. * kubedns_version
  17. #### Unsafe upgrade example
  18. If you wanted to upgrade just kube_version from v1.4.3 to v1.4.6, you could
  19. deploy the following way:
  20. ```
  21. ansible-playbook cluster.yml -i inventory/sample/hosts.ini -e kube_version=v1.4.3
  22. ```
  23. And then repeat with v1.4.6 as kube_version:
  24. ```
  25. ansible-playbook cluster.yml -i inventory/sample/hosts.ini -e kube_version=v1.4.6
  26. ```
  27. #### Graceful upgrade
  28. Kubespray also supports cordon, drain and uncordoning of nodes when performing
  29. a cluster upgrade. There is a separate playbook used for this purpose. It is
  30. important to note that upgrade-cluster.yml can only be used for upgrading an
  31. existing cluster. That means there must be at least 1 kube-master already
  32. deployed.
  33. ```
  34. git fetch origin
  35. git checkout origin/master
  36. ansible-playbook upgrade-cluster.yml -b -i inventory/sample/hosts.ini -e kube_version=v1.6.0
  37. ```
  38. After a successul upgrade, the Server Version should be updated:
  39. ```
  40. $ kubectl version
  41. Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-03-28T19:15:41Z", GoVersion:"go1.8", Compiler:"gc", Platform:"darwin/amd64"}
  42. Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0+coreos.0", GitCommit:"8031716957d697332f9234ddf85febb07ac6c3e3", GitTreeState:"clean", BuildDate:"2017-03-29T04:33:09Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
  43. ```
  44. #### Upgrade order
  45. As mentioned above, components are upgraded in the order in which they were
  46. installed in the Ansible playbook. The order of component installation is as
  47. follows:
  48. * Docker
  49. * etcd
  50. * kubelet and kube-proxy
  51. * network_plugin (such as Calico or Weave)
  52. * kube-apiserver, kube-scheduler, and kube-controller-manager
  53. * Add-ons (such as KubeDNS)
  54. #### Upgrade considerations
  55. Kubespray supports rotating certificates used for etcd and Kubernetes
  56. components, but some manual steps may be required. If you have a pod that
  57. requires use of a service token and is deployed in a namespace other than
  58. `kube-system`, you will need to manually delete the affected pods after
  59. rotating certificates. This is because all service account tokens are dependent
  60. on the apiserver token that is used to generate them. When the certificate
  61. rotates, all service account tokens must be rotated as well. During the
  62. kubernetes-apps/rotate_tokens role, only pods in kube-system are destroyed and
  63. recreated. All other invalidated service account tokens are cleaned up
  64. automatically, but other pods are not deleted out of an abundance of caution
  65. for impact to user deployed pods.