diff --git a/CHANGELOG-0.2.md b/CHANGELOG-0.2.md index dcbeabad45..a103970cdf 100644 --- a/CHANGELOG-0.2.md +++ b/CHANGELOG-0.2.md @@ -1,5 +1,21 @@ # Changelog 0.2 +## [0.2.2] 2019-03-29 + +### Added + +- Documentation for manual upgrade Kubernetes from 1.13.0 to 1.13.1 [link](./docs/home/HOWTO.md#how-to-upgrade-kubernetes-cluster-from-1130-to-1131) + +### Changed + +- Kubernetes version 1.13.1 #178 +- Docker version for RedHat to 18.06 + +### Fixed + +- Workaround issue where [Kubelet depends on kubernetes-cni 0.6.0](https://github.com/kubernetes/kubernetes/issues/75683) #177 +- Fix Kafka url #183 + ## [0.2.1] 2019-03-07 ### Fixed diff --git a/core/core/src/ansible/roles/docker/tasks/RedHat.yml b/core/core/src/ansible/roles/docker/tasks/RedHat.yml index 46400f46ad..6c79738ab0 100644 --- a/core/core/src/ansible/roles/docker/tasks/RedHat.yml +++ b/core/core/src/ansible/roles/docker/tasks/RedHat.yml @@ -1,7 +1,14 @@ --- +- name: Add Docker-CE stable repo + yum_repository: + name: docker-ce-stable + description: Docker CE Stable Repo + baseurl: https://download.docker.com/linux/centos/7/$basearch/stable + gpgkey: https://download.docker.com/linux/centos/gpg + gpgcheck: yes + - name: Install Docker yum: - name: docker + name: docker-ce-18.06.3.ce-3.el7 state: present update_cache: yes - when: ansible_os_family == "RedHat" diff --git a/core/core/src/ansible/roles/docker/tasks/configure-docker.yml b/core/core/src/ansible/roles/docker/tasks/configure-docker.yml index 09990dd63f..9de0a1005e 100644 --- a/core/core/src/ansible/roles/docker/tasks/configure-docker.yml +++ b/core/core/src/ansible/roles/docker/tasks/configure-docker.yml @@ -1,12 +1,4 @@ --- -- name: Unset log driver if defined in /etc/sysconfig/docker - replace: # remove --log-driver=driver-name to configure log-driver in daemon.json - path: /etc/sysconfig/docker - regexp: '^(OPTIONS=.*?)(?:--log-driver=[\w|-]+\s*|\s+--log-driver=[\w|-]+)(.*)$' - replace: '\1\2' - notify: Restart Docker - when: ansible_os_family == "RedHat" - - name: Copy configuration file (daemon.json) template: src: daemon.json.j2 diff --git a/core/core/src/ansible/roles/kafka/tasks/setup-kafka.yml b/core/core/src/ansible/roles/kafka/tasks/setup-kafka.yml index 8f37536f43..e54a0ffb66 100644 --- a/core/core/src/ansible/roles/kafka/tasks/setup-kafka.yml +++ b/core/core/src/ansible/roles/kafka/tasks/setup-kafka.yml @@ -3,10 +3,10 @@ stat: path: "/tmp/kafka_{{ kafka_var.scala.version }}-{{ kafka_var.version }}.tgz" register: kafka_check - + - name: Fetch Kafka binary package get_url: - url: "http://apache.mirrors.tds.net/kafka/{{ kafka_var.version }}/kafka_{{ kafka_var.scala.version }}-{{ kafka_var.version }}.tgz" + url: "https://archive.apache.org/dist/kafka/{{ kafka_var.version }}/kafka_{{ kafka_var.scala.version }}-{{ kafka_var.version }}.tgz" dest: "/tmp/kafka_{{ kafka_var.scala.version }}-{{ kafka_var.version }}.tgz" when: not kafka_check.stat.exists diff --git a/core/core/src/ansible/roles/kubernetes-common/tasks/install-packages.yml b/core/core/src/ansible/roles/kubernetes-common/tasks/install-packages.yml index f1c1c17f91..85709e504a 100644 --- a/core/core/src/ansible/roles/kubernetes-common/tasks/install-packages.yml +++ b/core/core/src/ansible/roles/kubernetes-common/tasks/install-packages.yml @@ -10,9 +10,10 @@ - samba-common when: kubernetes.storage.enable == True -- name: Install RedHat family packages +- name: Install Kubernetes packages for RedHat family yum: name: + - kubernetes-cni-0.6.0-0 # todo remove it in future release - kubelet-{{kubernetes.version}} - kubectl-{{kubernetes.version}} - kubeadm-{{kubernetes.version}} @@ -20,9 +21,10 @@ state: present when: ansible_os_family == "RedHat" -- name: Install Debian family packages +- name: Install Kubernetes packages for Debian family apt: name: + - kubernetes-cni=0.6.0-00 # todo remove it in future release - kubelet={{kubernetes.version}}-00 - kubectl={{kubernetes.version}}-00 - kubeadm={{kubernetes.version}}-00 diff --git a/core/core/src/templates/common/manifest.yaml.j2 b/core/core/src/templates/common/manifest.yaml.j2 index 70ed0112c3..eda707ec3b 100644 --- a/core/core/src/templates/common/manifest.yaml.j2 +++ b/core/core/src/templates/common/manifest.yaml.j2 @@ -87,7 +87,7 @@ nodes: {%- endfor %} kubernetes: - version: 1.13.0 #latest + version: 1.13.1 storage: enable: {{ core.kubernetes.storage.enable }} type: {{ core.kubernetes.storage.type }} diff --git a/core/data/azure/infrastructure/epiphany-bld-apps/data.yaml b/core/data/azure/infrastructure/epiphany-bld-apps/data.yaml index ae47958f78..34aaaebecb 100644 --- a/core/data/azure/infrastructure/epiphany-bld-apps/data.yaml +++ b/core/data/azure/infrastructure/epiphany-bld-apps/data.yaml @@ -8,7 +8,7 @@ title: Epiphany Apps Infrastructure... kind: datafile -version: 0.2.0 +version: 0.2.2 # NOTE: Any data values that are empty put "" or the value None will be used in the templates for those attributes. @@ -1128,7 +1128,7 @@ core: kubernetes: - version: 1.13.0 + version: 1.13.1 # image_registry_secrets: # - name: regcred # server_url: your-registry-url diff --git a/core/data/azure/infrastructure/epiphany-playground/basic-data.yaml b/core/data/azure/infrastructure/epiphany-playground/basic-data.yaml index 898b8d4f7f..552435fa0d 100644 --- a/core/data/azure/infrastructure/epiphany-playground/basic-data.yaml +++ b/core/data/azure/infrastructure/epiphany-playground/basic-data.yaml @@ -2,7 +2,7 @@ # Simplified datafile that you can use together with template (see README.md in this folder). # Change values according to your needs, start with generating ssh keys and placing them in the directory "keys_directory". Do not forget to update "keys_directory" as well. kind: simplified-datafile -version: 0.2.0 +version: 0.2.2 environment_name: Playground azure: subscription_name: YOUR-SUBSCRIPTION-NAME diff --git a/core/data/azure/infrastructure/epiphany-template/data.yaml.j2 b/core/data/azure/infrastructure/epiphany-template/data.yaml.j2 index 5fd7dcfe82..930cb82537 100644 --- a/core/data/azure/infrastructure/epiphany-template/data.yaml.j2 +++ b/core/data/azure/infrastructure/epiphany-template/data.yaml.j2 @@ -9,7 +9,7 @@ title: Epiphany ({{ azure.image_offer }}) {{ environment_name }} kind: datafile -version: 0.2.0 +version: 0.2.2 # NOTE: Any data values that are empty put "" or the value None will be used in the templates for those attributes. @@ -27,7 +27,7 @@ core: build: # IMPORTANT - will be appended to release name and output folder and part of the template names - version: &version 0.1.21 + version: &version 0.2.2 # Type of build environment environment: &env development # Name of the given release. Version will be appended @@ -1167,7 +1167,7 @@ core: {% endif %} kubernetes: - version: 1.13.0 + version: 1.13.1 # image_registry_secrets: # - name: regcred # server_url: your-registry-url diff --git a/core/data/metal/epiphany-lab/data.yaml b/core/data/metal/epiphany-lab/data.yaml index 73608a0f90..05ac565859 100644 --- a/core/data/metal/epiphany-lab/data.yaml +++ b/core/data/metal/epiphany-lab/data.yaml @@ -324,7 +324,7 @@ nodes: private: 192.168.1.66 kubernetes: - version: 1.13.0 + version: 1.13.1 storage: enable: False diff --git a/core/data/metal/single-machine/data.yaml b/core/data/metal/single-machine/data.yaml index 6aefc14e72..c55a044b2c 100644 --- a/core/data/metal/single-machine/data.yaml +++ b/core/data/metal/single-machine/data.yaml @@ -103,7 +103,7 @@ nodes: private: 192.168.1.2 kubernetes: - version: 1.13.0 + version: 1.13.1 #image_registry_secrets: # - name: regcred # server_url: your-registry-url diff --git a/core/data/vmware/epiphany-lab/data.yaml b/core/data/vmware/epiphany-lab/data.yaml index 099dc635cb..3bfed06b13 100644 --- a/core/data/vmware/epiphany-lab/data.yaml +++ b/core/data/vmware/epiphany-lab/data.yaml @@ -324,7 +324,7 @@ nodes: private: 192.168.1.66 kubernetes: - version: 1.13.0 + version: 1.13.1 storage: enable: False diff --git a/core/manifest.yaml b/core/manifest.yaml index fe75bb9c5d..d8eddc443f 100644 --- a/core/manifest.yaml +++ b/core/manifest.yaml @@ -3,7 +3,7 @@ # This data is for the core of Epiphany and not the data for a given environment. name: Epiphany -version: 0.2.0 +version: 0.2.2 # Set the proxy info up if your environment requires it. This is sometimes the case for on-premise builds/installs proxy: diff --git a/core/version.sh b/core/version.sh index c95caacba7..49c1c524cf 100755 --- a/core/version.sh +++ b/core/version.sh @@ -25,5 +25,5 @@ set -e unset EPIPHANY_VERSION unset EPIPHANY_VERSION_NAME -export EPIPHANY_VERSION="0.2.0" +export EPIPHANY_VERSION="0.2.2" export EPIPHANY_VERSION_NAME="Epiphany" \ No newline at end of file diff --git a/docs/home/HOWTO.md b/docs/home/HOWTO.md index fab96ebee5..599e4c9e90 100644 --- a/docs/home/HOWTO.md +++ b/docs/home/HOWTO.md @@ -29,7 +29,8 @@ - [How to run chaos on Epiphany Kubernetes cluster and monitor it with Grafana](#how-to-run-chaos-on-epiphany-kubernetes-cluster-and-monitor-it-with-grafana) - [How to tunnel Kubernetes dashboard from remote kubectl to your PC](#how-to-tunnel-kubernetes-dashboard-from-remote-kubectl-to-your-pc) - [How to setup Azure VM as docker machine for development](#how-to-setup-azure-vm-as-docker-machine-for-development) - - [How to upgrade Kubernetes cluster](#how-to-upgrade-kubernete-cluster) + - [How to upgrade Kubernetes cluster](#how-to-upgrade-kubernetes-cluster) + - [How to upgrade Kubernetes cluster from 1.13.0 to 1.13.1](#how-to-upgrade-kubernetes-cluster-from-1130-to-1131) - [How to authenticate to Azure AD app](#how-to-authenticate-to-azure-ad-app) - [How to expose service through HA Proxy load balancer](#how-to-expose-service-lb) - Security @@ -786,7 +787,7 @@ Upgrade procedure might be different for each Kubernetes version. Upgrade shall Each version can be upgraded in a bit different way, to find information how to upgrade your version of Kubernetes please use this [guide](https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-upgrade/#kubeadm-upgrade-guidance). -Epiphany use kubeadm to boostrap a cluster and same tool shall be used to upgrade it. +Epiphany uses kubeadm to boostrap a cluster and the same tool is also used to upgrade it. Upgrading Kubernetes cluster with running applications shall be done step by step. To prevent your applications downtime you should use at least **two Kubernetes worker nodes** and at least **two instances of each of your service**. @@ -794,6 +795,160 @@ Start cluster upgrade with upgrading master node. Detailed instructions how to u Once master upgrade finished successfully, you shall start upgrading nodes - **one by one**. Kubernetes master will notice when worker node is down and it will instatiate services on existing operating node, that is why it is essential to have more than one worker node in cluster to minimize applications downtime. +## How to upgrade Kubernetes cluster from 1.13.0 to 1.13.1 + +Detailed instruction can be found in [Kubernetes upgrade to 1.13 documentation](https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade-1-13/) + +### Ubuntu Server + +#### Upgrade Master + +```bash +# RUN ON MASTER + +1. sudo kubeadm version # should show v1.13.0 +2. sudo kubeadm upgrade plan v1.13.1 + +3. apt update +4. apt-cache policy kubeadm + + +5. sudo apt-mark unhold kubeadm && \ +sudo apt-get update && sudo apt-get install -y kubeadm=1.13.1-00 && \ +sudo apt-mark hold kubeadm + +6. sudo kubeadm version # should show v1.13.1 +7. sudo kubeadm upgrade plan v1.13.1 + +8. sudo kubeadm upgrade apply v1.13.1 + +9. sudo apt-mark unhold kubelet && \ +sudo apt-get update && sudo apt-get install -y kubelet=1.13.1-00 && \ +sudo apt-mark hold kubelet +``` + +#### Upgrade Worker Nodes + +Commands below should be run in context of each node in the cluster. Variable `$NODE` represents node name (node names can be retrieved by command `kubectl get nodes` on master) + +Worker nodes will be upgraded one by one - it will prevent application downtime. + +```bash + +# RUN ON WORKER NODE - $NODE + +1. sudo apt-mark unhold kubectl && \ +sudo apt-get update && sudo apt-get install -y kubectl=1.13.1-00 && \ +sudo apt-mark hold kubectl + +# RUN ON MASTER + +2. kubectl drain $NODE --ignore-daemonsets + +# RUN ON WORKER NODE - $NODE + +3. sudo kubeadm upgrade node config --kubelet-version v1.13.1 + +4. sudo apt-get update +5. sudo apt-get install -y kubelet=1.13.1-00 kubeadm=1.13.1-00 + +6. sudo systemctl restart kubelet +7. sudo systemctl status kubelet # should be running + +# RUN ON MASTER + +8. kubectl uncordon $NODE + +9. # go to 1. for next node + +# RUN ON MASTER +10. kubectl get nodes # should return nodes in status "Ready" and version 1.13.1 + +``` + +### RHEL + +#### Upgrade Docker version + +Upgrading Kubernetes to 1.13.1 on RHEL requires Docker upgrade. Newer Docker packages exist in docker-ce repository but you can use newer Docker-ee if you need. Verified Docker versions for Kubernetes are: 1.11.1, 1.12.1, 1.13.1, 17.03, 17.06, 17.09, 18.06. [Go to K8s docs](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.13.md#external-dependencies) + +```bash + +# Remove previous docker version +1 sudo yum remove docker \ + docker-common \ + container-selinux \ + docker-selinux \ + docker-engine +2. sudo rm -rf /var/lib/docker +3. sudo rm -rf /run/docker +4. sudo rm -rf /var/run/docker +5. sudo rm -rf /etc/docker + +# Add docker-ce repository +6. sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo +7. sudo yum makecache fast +8. sudo yum -y install docker-ce-18.06.3.ce-3.el7 + +``` + +#### Upgrade Master + +```bash +# RUN ON MASTER + +1. sudo kubeadm version # should show v1.13.0 +2. sudo kubeadm upgrade plan v1.13.1 + +3. sudo yum install -y kubeadm-1.13.1-0 --disableexcludes=kubernetes + +4. sudo kubeadm version # should show v1.13.1 +5. sudo kubeadm upgrade plan v1.13.1 + +6. sudo kubeadm upgrade apply v1.13.1 + +7. sudo yum install -y kubelet-1.13.1-0 --disableexcludes=kubernetes + +``` + +#### Upgrade Worker Nodes + +Commands below should be run in context of each node in the cluster. Variable `$NODE` represents node name (node names can be retrieved by command `kubectl get nodes` on master) + +Worker nodes will be upgraded one by one - it will prevent application downtime. + +```bash + +# RUN ON WORKER NODE - $NODE + +1. yum install -y kubectl-1.13.1-0 --disableexcludes=kubernetes + +# RUN ON MASTER + +2. kubectl drain $NODE --ignore-daemonsets + +# RUN ON WORKER NODE - $NODE + +3. # Upgrade Docker version using instruction from above + +4. sudo kubeadm upgrade node config --kubelet-version v1.13.1 + +5. sudo yum install -y kubelet-1.13.1-0 kubeadm-1.13.1-0 --disableexcludes=kubernetes + +6. sudo systemctl restart kubelet +7. sudo systemctl status kubelet # should be running + +# RUN ON MASTER + +8. kubectl uncordon $NODE + +9. # go to 1. for next node + +# RUN ON MASTER +10. kubectl get nodes # should return nodes in status "Ready" and version 1.13.1 + +``` + ## How to upgrade Kafka cluster ### Kafka upgrade