This repository contains the code and instructions for the hpcloud-kubesetup installer tool. The hpcloud-kubesetup installer enables you to create and deploy Kubernetes (1.0.1) clusters on to your own private HP Helion OpenStack environment (version 1.1 or later) or to your hosted HP Helion Public Cloud account.
The installer process runs on your workstation, provisioning the cluster remotely.
-
Download and install the hpcloud-kubesetup installer and Kubernetes kubectl utility for your specific platform:
Linux
Script based installation folllow these instructions.
Manual installation steps:
mkdir -p /usr/local/kubernetes
wget https://github.com/hpcloud/hpcloud-kubesetup/raw/master/bin/hpcloud-kubesetup-linux.zip \
-O /usr/local/kubernetes/hpcloud-kubesetup-linux.zip
unzip -o /usr/local/kubernetes/hpcloud-kubesetup-linux.zip -d /usr/local/kubernetes/
wget https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl \
-O /usr/local/kubernetes/linux/kubectl
chmod +x /usr/local/kubernetes/linux/hpcloud-kubesetup
ln -s /usr/local/kubernetes/linux/hpcloud-kubesetup /usr/local/bin/hpcloud-kubesetup
chmod +x /usr/local/kubernetes/linux/kubectl
ln -s /usr/local/kubernetes/linux/kubectl /usr/local/bin/kubectl
mkdir -p ~/kubernetes
cp -n /usr/local/kubernetes/linux/kubesetup.yml ~/kubernetes/.
Mac
Script based installation folllow these instructions.
Manual installation steps:
mkdir -p /usr/local/kubernetes
wget https://github.com/hpcloud/hpcloud-kubesetup/raw/master/bin/hpcloud-kubesetup-darwin.zip \
-O /usr/local/kubernetes/hpcloud-kubesetup-darwin.zip
unzip -o /usr/local/kubernetes/hpcloud-kubesetup-darwin.zip -d /usr/local/kubernetes/
wget https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/darwin/amd64/kubectl \
-O /usr/local/kubernetes/darwin/kubectl
chmod +x /usr/local/kubernetes/darwin/hpcloud-kubesetup
ln -s /usr/local/kubernetes/darwin/hpcloud-kubesetup /usr/local/bin/hpcloud-kubesetup
chmod +x /usr/local/kubernetes/darwin/kubectl
ln -s /usr/local/kubernetes/darwin/kubectl /usr/local/bin/kubectl
mkdir -p ~/kubernetes
cp -n /usr/local/kubernetes/darwin/kubesetup.yml ~/kubernetes/.
Windows
Script based installation folllow these instructions.
Manual installation steps:
- Download hpcloud-kubesetup-windows.zip
- Unzip hpcloud-kubesetup.zip
- Download kubectl.exe
-
Log into the OpenStack Horizon portal with your account and download the "OpenStack RC file" located on the Project\Access & Security panel inside the API Access tab. The download button is on the top right corner.
-
Setup OpenStack environment variables
Mac & Linux
Execute the OpenStack resource script. The script will ask you to enter your OpenStack password. All settings will be exported as environment variables.
source ./<your project name>-openrc.sh
To inspect what was exported, run export | grep OS_
. You should see a similar result to:
$ export | grep OS_
declare -x OS_AUTH_URL="https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/"
declare -x OS_PASSWORD="My Very Secret Password"
declare -x OS_TENANT_ID="12345678901234"
declare -x OS_TENANT_NAME="kubernetes"
declare -x OS_USERNAME="kube"
Windows
Rename the downloaded -openrc.sh file to -openrc.bat
Open the -openrc.bat file within an editor like notepad.
Replace the export statement with set statement, like shown below.
set OS_AUTH_URL=<OS_AUTH_URL>
set OS_TENANT_ID=<OS_TENANT_ID>
set OS_TENANT_NAME=<OS_TENANT_NAME>
set OS_USERNAME=<OS_USERNAME>
set OS_PASSWORD=<OS_PASSWORD>
set OS_REGION_NAME=<OS_REGION_NAME>
Run the -openrc.bat file inside the console window from which we will the remaining installer steops
-
Update kubesetup.yml
if necessary. This file describes the setup of the cluster. By default, a cluster consisting of 3 nodes, 1 master node and 2 minion nodes, will be created.
You will need to:
- Create a new ssh key named
kube-key
or modify sshkey
to reflect the key name of an existing key pair inside OpenStack
- Create the kube-net network (steps) or modify the network entry in the kubesetup.yml file to an existing private network inside the project/tenant you will be deploying to
- Verify if specified IP address range is supported by your subnet. When using the create-private-network.sh script you can use the default values
kubesetup.yml
hosts:
kube-master:
ip: 192.168.1.140
ismaster: true
vm-image: CoreOS
vm-size: standard.medium
kube-node-1:
ip: 192.168.1.141
ismaster: false
vm-image: CoreOS
vm-size: standard.small
kube-node-2:
ip: 192.168.1.142
ismaster: false
vm-image: CoreOS
vm-size: standard.small
sshkey: kube-key
network: kube-net
availabilityZone: az2
-
Once your kubesetup.yml
reflects the type of cluster you want to create, you can then execute the cluster installer:
Mac & Linux
hpcloud-kubesetup install
Windows
hpcloud-kubesetup.exe install
Once run, you should see the following results:
$ hpcloud-kubesetup install
2015/07/23 12:06:23 config file - kube-master {192.168.1.140 true CoreOS standard.medium }
2015/07/23 12:06:23 config file - kube-node-1 {192.168.1.141 false CoreOS standard.small }
2015/07/23 12:06:23 config file - kube-node-2 {192.168.1.142 false CoreOS standard.small }
2015/07/23 12:06:23 config file - SSHKey <redacted>
2015/07/23 12:06:23 config file - Network kube-net
2015/07/23 12:06:23 config file - AvailabilityZone az2
2015/07/23 12:06:23 OS_AUTH_URL - <redacted>
2015/07/23 12:06:23 OS_TENANT_ID - <redacted>
2015/07/23 12:06:23 OS_TENANT_NAME - <redacted>
2015/07/23 12:06:23 OS_USERNAME - <redacted>
2015/07/23 12:06:23 OS_REGION_NAME - <redacted>
2015/07/23 12:06:23 OS_AUTH_TOKEN -
2015/07/23 12:06:23 OS_CACERT -
2015/07/23 12:06:23 skip-ssl-validation - false
2015/07/23 12:06:23 debug - false
2015/07/23 12:06:24 token - HPAuth10_9b0328c27a31d4c4ff52cbd447270a8bc909572cbccf76b770c1cb06cc9f1986
2015/07/23 12:06:25 network - aca348f6-b481-469b-8aef-efd235987578
2015/07/23 12:06:25 create cloudconfig - kube-master
2015/07/23 12:06:25 create cloudconfig - kube-master.yml COMPLETED
2015/07/23 12:06:25 create cloudconfig - kube-node-1
2015/07/23 12:06:25 create cloudconfig - kube-node-1.yml COMPLETED
2015/07/23 12:06:25 create cloudconfig - kube-node-2
2015/07/23 12:06:25 create cloudconfig - kube-node-2.yml COMPLETED
2015/07/23 12:06:25 create port - kube-master 192.1.168.140
2015/07/23 12:06:26 create port - 86587b0b-4351-467e-baaf-882a6f71f952 COMPLETED
2015/07/23 12:06:26 create server - kube-master 192.168.1.140
2015/07/23 12:06:27 image - 5c2ccd59-1ae8-417a-8abc-22fb4f4b9f85
2015/07/23 12:06:27 flavor - 102
2015/07/23 12:06:28 create server - password <redacted>
2015/07/23 12:06:28 create server - a77e155a-847f-41b8-a523-6d14a044a568 COMPLETED
2015/07/23 12:06:28 create port - kube-node-1 192.168.1.141
2015/07/23 12:06:28 create port - fb1180ea-134d-477f-a9a0-ad1e1ea9e447 COMPLETED
2015/07/23 12:06:28 create server - kube-node-1 192.168.1.141
2015/07/23 12:06:29 image - 5c2ccd59-1ae8-417a-8abc-22fb4f4b9f85
2015/07/23 12:06:29 flavor - 101
2015/07/23 12:06:29 create server - password <redacted>
2015/07/23 12:06:29 create server - 2627034a-6673-4837-976f-2620f4e4af4a COMPLETED
2015/07/23 12:06:29 create port - kube-node-2 192.168.1.142
2015/07/23 12:06:30 create port - a9a62294-9ce8-4804-8a93-3f0d5808b19a COMPLETED
2015/07/23 12:06:30 create server - kube-node-2 192.168.1.142
2015/07/23 12:06:30 image - 5c2ccd59-1ae8-417a-8abc-22fb4f4b9f85
2015/07/23 12:06:30 flavor - 101
2015/07/23 12:06:31 create server - password <redacted>
2015/07/23 12:06:31 create server - 5bae49a3-e1c4-4a3e-8443-31702442a4e7 COMPLETED
2015/07/23 12:06:31 server status - kube-master BUILD
2015/07/23 12:06:54 server status - kube-master ACTIVE
2015/07/23 12:06:54 server status - kube-node-1 ACTIVE
2015/07/23 12:06:54 server status - kube-node-2 ACTIVE
2015/07/23 12:06:54 associate IP - kube-master 15.125.106.149
2015/07/23 12:06:55 associate IP - kube-master COMPLETED
-
The installer associates a floating IP address with the Kubernetes master node. You can find the floating IP in list if server instances in the Horizon panel or by using the nova list command. The next step is use kubectl to explore and inspect the cluster.
Mac & Linux & Windows
$ kubectl cluster-info --server=http://15.125.106.149:8080
Kubernetes master is running at http://15.125.106.149:8080
$ kubectl version --server=http://15.125.106.149:8080
Client Version: version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.1", GitCommit:"6a5c06e3d1eb27a6310a09270e4a5fb1afa93e74", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.1", GitCommit:"6a5c06e3d1eb27a6310a09270e4a5fb1afa93e74", GitTreeState:"clean"}
$ kubectl get nodes --server=http://15.125.106.149:8080
NAME LABELS STATUS
192.168.1.141 kubernetes.io/hostname=192.168.1.141 Ready
192.168.1.142 kubernetes.io/hostname=192.168.1.142 Ready
Alternatively for Mac & Linux you can setup a secure SSH tunel between the kubectl client and the kube-apiserver, this prevents from having to provide the --server parameter on each call. The confige the SSH tunel use the following command:
ssh -f -nNT -L 8080:127.0.0.1:8080 core@<master-public-ip>
ssh -f -nNT -L 8080:127.0.0.1:8080 core@15.125.106.149
$ kubectl get services
NAME LABELS SELECTOR IP(S) PORT(S)
kubernetes component=apiserver,provider=kubernetes <none> 10.100.0.1 443/TCP
-
After verifying all the nodes are there, optionally create a context and use it, so that kubectl can be used without specifying the server on every call.
$ kubectl config set-cluster hpcloud --server=http://15.125.106.149:8080
$ kubectl config set-context hpcloud --cluster=hpcloud
$ kubectl config use-context hpcloud
$ kubectl get nodes
NAME LABELS STATUS
192.168.1.141 kubernetes.io/hostname=192.168.1.141 Ready
192.168.1.142 kubernetes.io/hostname=192.168.1.142 Ready
-
After verifying the current kubectl context is set correctly, you are ready to rock and roll. The next step will be to deploy a sample application to your Kubernetes cluster!
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.