upgrade k8s to 1.0.6 for ubuntu
This commit is contained in:
		| @@ -53,7 +53,7 @@ fi | |||||||
| cp $ETCD/etcd $ETCD/etcdctl binaries/master | cp $ETCD/etcd $ETCD/etcdctl binaries/master | ||||||
|  |  | ||||||
| # k8s | # k8s | ||||||
| KUBE_VERSION=${KUBE_VERSION:-"1.0.3"} | KUBE_VERSION=${KUBE_VERSION:-"1.0.6"} | ||||||
| echo "Prepare kubernetes ${KUBE_VERSION} release ..." | echo "Prepare kubernetes ${KUBE_VERSION} release ..." | ||||||
| if [ ! -f kubernetes.tar.gz ] ; then | if [ ! -f kubernetes.tar.gz ] ; then | ||||||
|   curl -L https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v${KUBE_VERSION}/kubernetes.tar.gz -o kubernetes.tar.gz |   curl -L https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v${KUBE_VERSION}/kubernetes.tar.gz -o kubernetes.tar.gz | ||||||
|   | |||||||
| @@ -460,7 +460,7 @@ function prepare-push() { | |||||||
|   fi |   fi | ||||||
| } | } | ||||||
|  |  | ||||||
| # Update a kubernetes master with required release | # Update a kubernetes master with expected release | ||||||
| function push-master { | function push-master { | ||||||
|   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" |   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" | ||||||
|  |  | ||||||
| @@ -502,7 +502,7 @@ function push-master { | |||||||
|   verify-cluster |   verify-cluster | ||||||
| } | } | ||||||
|  |  | ||||||
| # Update a kubernetes node with required release | # Update a kubernetes node with expected release | ||||||
| function push-node() { | function push-node() { | ||||||
|   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" |   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" | ||||||
|  |  | ||||||
| @@ -545,7 +545,7 @@ function push-node() { | |||||||
|    |    | ||||||
| } | } | ||||||
|  |  | ||||||
| # Update a kubernetes cluster with required source | # Update a kubernetes cluster with expected source | ||||||
| function kube-push {  | function kube-push {  | ||||||
|   prepare-push |   prepare-push | ||||||
|   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" |   source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" | ||||||
|   | |||||||
| @@ -36,12 +36,13 @@ Kubernetes Deployment On Bare-metal Ubuntu Nodes | |||||||
| - [Introduction](#introduction) | - [Introduction](#introduction) | ||||||
| - [Prerequisites](#prerequisites) | - [Prerequisites](#prerequisites) | ||||||
| - [Starting a Cluster](#starting-a-cluster) | - [Starting a Cluster](#starting-a-cluster) | ||||||
|     - [Download binaries](#download-binaries) |     - [Set up working directory](#set-up-working-directory) | ||||||
|     - [Configure and start the kubernetes cluster](#configure-and-start-the-kubernetes-cluster) |     - [Configure and start the kubernetes cluster](#configure-and-start-the-kubernetes-cluster) | ||||||
|     - [Test it out](#test-it-out) |     - [Test it out](#test-it-out) | ||||||
|     - [Deploy addons](#deploy-addons) |     - [Deploy addons](#deploy-addons) | ||||||
|     - [Trouble shooting](#trouble-shooting) |     - [Trouble shooting](#trouble-shooting) | ||||||
| - [Upgrading a Cluster](#upgrading-a-cluster) | - [Upgrading a Cluster](#upgrading-a-cluster) | ||||||
|  |     - [Test it out](#test-it-out-ii) | ||||||
|  |  | ||||||
| ## Introduction | ## Introduction | ||||||
|  |  | ||||||
| @@ -55,42 +56,39 @@ work, which has been merge into this document. | |||||||
| ## Prerequisites | ## Prerequisites | ||||||
|  |  | ||||||
| 1. The nodes have installed docker version 1.2+ and bridge-utils to manipulate linux bridge. | 1. The nodes have installed docker version 1.2+ and bridge-utils to manipulate linux bridge. | ||||||
| 2. All machines can communicate with each other. Master node needs to connect the Internet to download the necessary files, while working nodes do not. | 2. All machines can communicate with each other. Master node needs to connect the Internet to download  | ||||||
|  | the necessary files, while working nodes do not. | ||||||
| 3. These guide is tested OK on Ubuntu 14.04 LTS 64bit server, but it can not work with | 3. These guide is tested OK on Ubuntu 14.04 LTS 64bit server, but it can not work with | ||||||
| Ubuntu 15 which use systemd instead of upstart. We are working around fixing this. | Ubuntu 15 which use systemd instead of upstart. We are working around fixing this. | ||||||
| 4. Dependencies of this guide: etcd-2.0.12, flannel-0.4.0, k8s-1.0.3, may work with higher versions. | 4. Dependencies of this guide: etcd-2.0.12, flannel-0.4.0, k8s-1.0.6, may work with higher versions. | ||||||
| 5. All the remote servers can be ssh logged in without a password by using key authentication. | 5. All the remote servers can be ssh logged in without a password by using key authentication. | ||||||
|  |  | ||||||
|  |  | ||||||
| ## Starting a Cluster | ## Starting a Cluster | ||||||
|  |  | ||||||
| ### Download binaries | ### Set up working directory | ||||||
|  |  | ||||||
| First clone the kubernetes github repo | Clone the kubernetes github repo locally | ||||||
|  |  | ||||||
| ``` console | ``` console | ||||||
| $ git clone https://github.com/kubernetes/kubernetes.git | $ git clone https://github.com/kubernetes/kubernetes.git | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Then download all the needed binaries into given directory (cluster/ubuntu/binaries) | #### Configure and start the Kubernetes cluster | ||||||
|  |  | ||||||
| ``` console |  | ||||||
| $ cd kubernetes/cluster/ubuntu |  | ||||||
| $ ./build.sh |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| You can customize your etcd version, flannel version, k8s version by changing corresponding variables | You can customize your etcd version, flannel version, k8s version by changing corresponding variables | ||||||
| `ETCD_VERSION` , `FLANNEL_VERSION` and `KUBE_VERSION` in build.sh, by default etcd version is 2.0.12, | `ETCD_VERSION` , `FLANNEL_VERSION` and `KUBE_VERSION` like following. | ||||||
| flannel version is 0.4.0 and k8s version is 1.0.3. |  | ||||||
|  |  | ||||||
| Make sure that the involved binaries are located properly in the binaries/master | ```console | ||||||
| or binaries/minion directory before you go ahead to the next step . | $ export KUBE_VERSION=1.0.3 | ||||||
|  | $ export FLANNEL_VERSION=0.5.3 | ||||||
|  | $ export ETCD_VERSION=2.2.0 | ||||||
|  | ``` | ||||||
|  | By default etcd version is 2.0.12, flannel version is 0.4.0 and k8s version is 1.0.6. | ||||||
|  |  | ||||||
| Note that we use flannel here to set up overlay network, yet it's optional. Actually you can build up k8s | Note that we use flannel here to set up overlay network, yet it's optional. Actually you can build up k8s | ||||||
| cluster natively, or use flannel, Open vSwitch or any other SDN tool you like. | cluster natively, or use flannel, Open vSwitch or any other SDN tool you like. | ||||||
|  |  | ||||||
| #### Configure and start the Kubernetes cluster |  | ||||||
|  |  | ||||||
| An example cluster is listed below: | An example cluster is listed below: | ||||||
|  |  | ||||||
| | IP Address  |   Role   | | | IP Address  |   Role   | | ||||||
| @@ -99,7 +97,7 @@ An example cluster is listed below: | |||||||
| |10.10.103.162|   node   | | |10.10.103.162|   node   | | ||||||
| |10.10.103.250| both master and node| | |10.10.103.250| both master and node| | ||||||
|  |  | ||||||
| First configure the cluster information in cluster/ubuntu/config-default.sh, below is a simple sample. | First configure the cluster information in cluster/ubuntu/config-default.sh, following is a simple sample. | ||||||
|  |  | ||||||
| ```sh | ```sh | ||||||
| export nodes="vcap@10.10.103.250 vcap@10.10.103.162 vcap@10.10.103.223" | export nodes="vcap@10.10.103.250 vcap@10.10.103.162 vcap@10.10.103.223" | ||||||
| @@ -113,7 +111,7 @@ export SERVICE_CLUSTER_IP_RANGE=192.168.3.0/24 | |||||||
| export FLANNEL_NET=172.16.0.0/16 | export FLANNEL_NET=172.16.0.0/16 | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| The first variable `nodes` defines all your cluster nodes, MASTER node comes first and | The first variable `nodes` defines all your cluster nodes, master node comes first and | ||||||
| separated with blank space like `<user_1@ip_1> <user_2@ip_2> <user_3@ip_3> ` | separated with blank space like `<user_1@ip_1> <user_2@ip_2> <user_3@ip_3> ` | ||||||
|  |  | ||||||
| Then the `role` variable defines the role of above machine in the same order, "ai" stands for machine | Then the `role` variable defines the role of above machine in the same order, "ai" stands for machine | ||||||
| @@ -135,7 +133,9 @@ that conflicts with your own private network range. | |||||||
| The `FLANNEL_NET` variable defines the IP range used for flannel overlay network, | The `FLANNEL_NET` variable defines the IP range used for flannel overlay network, | ||||||
| should not conflict with above `SERVICE_CLUSTER_IP_RANGE`. | should not conflict with above `SERVICE_CLUSTER_IP_RANGE`. | ||||||
|  |  | ||||||
| **Note:** When deploying, master needs to connect the Internet to download the necessary files. If your machines locate in a private network that need proxy setting to connect the Internet, you can set the config `PROXY_SETTING` in cluster/ubuntu/config-default.sh such as: | **Note:** When deploying, master needs to connect the Internet to download the necessary files.  | ||||||
|  | If your machines locate in a private network that need proxy setting to connect the Internet,  | ||||||
|  | you can set the config `PROXY_SETTING` in cluster/ubuntu/config-default.sh such as: | ||||||
|  |  | ||||||
|      PROXY_SETTING="http_proxy=http://server:port https_proxy=https://server:port" |      PROXY_SETTING="http_proxy=http://server:port https_proxy=https://server:port" | ||||||
|  |  | ||||||
| @@ -143,16 +143,16 @@ After all the above variables being set correctly, we can use following command | |||||||
|  |  | ||||||
| `$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh` | `$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh` | ||||||
|  |  | ||||||
| The scripts automatically scp binaries and config files to all the machines and start the k8s service on them. | The scripts automatically scp binaries and config files to all the machines and start k8s service on them. | ||||||
| The only thing you need to do is to type the sudo password when promoted. | The only thing you need to do is to type the sudo password when promoted. | ||||||
|  |  | ||||||
| ```console | ```console | ||||||
| Deploying minion on machine 10.10.103.223 | Deploying minion on machine 10.10.103.223 | ||||||
| ... | ... | ||||||
| [sudo] password to copy files and start minion:  | [sudo] password to start minion:  | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| If all things goes right, you will see the below message from console indicating the k8s is up. | If everything works expectedly, you will see the following message from console indicating the k8s cluster is up. | ||||||
|  |  | ||||||
| ```console | ```console | ||||||
| Cluster validation succeeded | Cluster validation succeeded | ||||||
| @@ -250,17 +250,20 @@ the latter one could start it again. | |||||||
| 4. You can also customize your own settings in `/etc/default/{component_name}`. | 4. You can also customize your own settings in `/etc/default/{component_name}`. | ||||||
|  |  | ||||||
|  |  | ||||||
| ### Upgrading a Cluster | ## Upgrading a Cluster | ||||||
|  |  | ||||||
| If you already have a kubernetes cluster, and want to upgrade to a new version, | If you already have a kubernetes cluster, and want to upgrade to a new version, | ||||||
| you can use following command in cluster/ directory to update the whole cluster or a specified node to a new version. | you can use following command in cluster/ directory to update the whole cluster  | ||||||
|  | or a specified node to a new version. | ||||||
|  |  | ||||||
| ```console | ```console | ||||||
| $ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh [-m|-n <node id>] <version> | $ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh [-m|-n <node id>] <version> | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| It can be done for all components (by default), master(`-m`) or specified node(`-n`). | It can be done for all components (by default), master(`-m`) or specified node(`-n`). | ||||||
| If the version is not specified, the script will try to use local binaries.You should ensure all the binaries are well prepared in path `cluster/ubuntu/binaries`. | Upgrading single node is experimental now. | ||||||
|  | If the version is not specified, the script will try to use local binaries. You should ensure all  | ||||||
|  | the binaries are well prepared in the expected directory path cluster/ubuntu/binaries. | ||||||
|  |  | ||||||
| ```console | ```console | ||||||
| $ tree cluster/ubuntu/binaries | $ tree cluster/ubuntu/binaries | ||||||
| @@ -279,21 +282,29 @@ binaries/ | |||||||
|     └── kube-proxy |     └── kube-proxy | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Upgrading single node is experimental now. You can use following command to get a help. | You can use following command to get a help. | ||||||
|  |  | ||||||
| ```console | ```console | ||||||
| $ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -h | $ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -h | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Some examples are as follows: | Here are some examples: | ||||||
|  |  | ||||||
| * upgrade master to version 1.0.5: `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -m 1.0.5` | * upgrade master to version 1.0.5: `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -m 1.0.5` | ||||||
| * upgrade node 10.10.103.223 to version 1.0.5 : `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -n 10.10.103.223 1.0.5` | * upgrade node 10.10.103.223 to version 1.0.5 : `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh -n 10.10.103.223 1.0.5` | ||||||
| * upgrade master and all nodes to version 1.0.5: `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh 1.0.5` | * upgrade master and all nodes to version 1.0.5: `$ KUBERNETES_PROVIDER=ubuntu ./kube-push.sh 1.0.5` | ||||||
|  |  | ||||||
| The script will not delete any resources of your cluster, it just replaces the binaries. | The script will not delete any resources of your cluster, it just replaces the binaries. | ||||||
| You can use `kubectl` command to check if the newly upgraded k8s is working correctly. |  | ||||||
| For example, use `$ kubectl get nodes` to see if all of your nodes are ready.Or refer to [test-it-out](ubuntu.md#test-it-out) | ### Test it out | ||||||
|  |  | ||||||
|  | You can use `kubectl` command to check if the newly upgraded k8s is working correctly. See  | ||||||
|  | also [test-it-out](ubuntu.md#test-it-out) | ||||||
|  |  | ||||||
|  | To make sure the version of upgraded cluster is expected, you will find these commands helpful. | ||||||
|  | * upgrade all components or master: `$ kubectl version`. Check the *Server Version*. | ||||||
|  | * upgrade node 10.10.102.223: `$ ssh -t vcap@10.10.102.223 'cd /opt/bin && sudo ./kubelet --version'` | ||||||
|  |  | ||||||
|  |  | ||||||
| <!-- BEGIN MUNGE: GENERATED_ANALYTICS --> | <!-- BEGIN MUNGE: GENERATED_ANALYTICS --> | ||||||
| []() | []() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 He Simei
					He Simei