Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add auto completion

...

The following table illustrate the steps that much run (tick) or can be skipped (minus) on the each of the Kubernetes cluster node.

Steps DescriptionKubernetes Node
Firstany other
Install Docker(tick)(tick)
Configure Kubernetes Cluster(tick)(tick)
Install kubectl(tick)(tick)

Install Helm

(expect OOM project will be mounted on the same node)

(tick)(minus)


Table of Contents


Install Docker

#PurposeCommand and Example
1

Install Docker 1.12

Check out compartible versions among Rancher, Kubernetes and Docker

curl https://releases.rancher.com/install-docker/1.12.sh | sh

Expand
titleExample of docker installation

$ curl https://releases.rancher.com/install-docker/1.12.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16609 100 16609 0 0 18977 0 --:--:-- --:--:-- --:--:-- 18960
apparmor is enabled in the kernel and apparmor utils were already installed
+ sudo -E sh -c sleep 3; apt-get update

...

+ sudo -E sh -c docker version
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Tue Jan 10 20:38:45 2017
OS/Arch: linux/amd64

Server:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Tue Jan 10 20:38:45 2017
OS/Arch: linux/amd64

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

sudo usermod -aG docker ubuntu

Remember that you will have to log out and back in for this to take effect!

$

2

Enable docker command for ubuntu user

as recommend from docker installation

sudo usermod -aG docker ubuntu

logout

log back in and validate docker command is usable by entering "docker"


Configure Kubernetes Cluster

...

#PurposeCommand and Example
1

Download kubectl on the server

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

Expand
titleExample of download kubectl process

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 49.8M  100 49.8M    0     0  15.3M      0  0:00:03  0:00:03 --:--:-- 15.3M

2

Enable the kubectl command

chmod +x kubectl

sudo mv kubectl /usr/local/bin/kubectl

vi ~/.bashrc

  • append the following to enable kubectl command auto-completion
    • source <(kubectl completion bash)

source ~/.bashrc

3

Generate config from the Rancher UI

  • From the Rancher UI, go to a Kubernetes CLI page through KUBERNETES -> CLI
  • Click on the Generate Config button to generate the config

  • The following content will be brought up; click on the Copy to Clipboard button to copy the generated config and use it in next step:


4

Create the kube config on the server

mkdir ~/.kube

vi ~/.kube/config

Paste the generated config from rancher UI (from last step) to this file, then save the file.

5

Validate the kube config

6

Validate the nodes added

kubectl get nodes

Expand
titleAn example

$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
sdnc-k8s Ready <none> 15m v1.7.7-rancher1
sdnc-k8s-2 Ready <none> 1m v1.7.7-rancher1
$

...