============================= Install and configure kubectl =========================
Reference: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl
---------------------------------- A),Install kubectl on CentOS/RHEL via yum --------------------------------------
A1), configure the kubernetes yum repo
vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
A2), # yum install -y kubectl
If you got an error like “Peer’s Certificate issuer is not recognized.”
It means you set the wrong certificate, please install kubectl binary using curl/wget.
If step A failed, you can install kubectl as step B, else ignore step B.
---------------------------------- B), Install kubectl binary using curl/wget on Linux ----------------------------------
B1), Download the latest release with the command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
To download a specific version, replace the $(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) portion of the command with the specific version.
For example, to download version v1.11.0 on Linux, type:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/amd64/kubectl
Or you can use wget to download the binary
wget https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/amd64/kubectl
If got an error: “ERROR: cannot verify storage.googleapis.com’s certificate…Unable to locally verify the issuer’s authority.”
To connect to storage.googleapis.com insecurely, use `–no-check-certificate’.
wget https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/amd64/kubectl --no-check-certificate
B2), Make the kubectl binary executable.
chmod +x ./kubectl
B3), Move the binary into your PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
---------------------------------- C), Config kubectl ----------------------------------
C), After you install kubectl, add cert and config in ~/.kube/
you can refer Azure VPN account about how to config ~/.kube
then check kubectl configuration with commands
ls ~/.kube/config
kubectl cluster-info
kubectl config view
Reference(Linux/MacOS/Windows): https://docs.aws.amazon.com/zh_cn/eks/latest/userguide/install-kubectl.html#install-kubectl-windows
========================= Install and configure Helm =========================
Prerequsiter:
I), K8S version >= 1.4.1
II), .kube/config is correct.
---------------------------------- A), Install the latest version helm. ----------------------------------
A1), # curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
A2), # chmod u+x get_helm.sh
A3), # ./get_helm.sh # this script downloads and uncompress archieve
A4), # helm init
A5), # helm list # run a command to check helm installation.
Error: incompatible versions client[v2.10.0] server[v2.9.1]
If approach A failed, you can install specific version helm as below, or please ignore this.
---------------------------------- B), Install specific version helm ----------------------------------
B1), Access to https://github.com/helm/helm/releases and find out the specific version download link for your OS.
e.g. https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-windows-amd64.zip
B2), # wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-windows-amd64.zip
B3), # tar -zxvf helm-v2.9.1-linux-amd64.tgz && mv linux-amd64/helm /usr/local/bin/helm
B4), # helm init
B5), # helm list # run a command to check helm installation.
Tips: Helm init will connect to kubernetes cluster ( use configuration in ~/.kube/config ) and install Tiller in kube-system namespace to your running Kubernetes cluster. It will also set up any necessary local configuration ( in ~/.helm ).