Local Kubernetes on CentOS

4/28/2017

I am trying to install Kubernetes locally on my CentOS. I am following this blog http://containertutorials.com/get_started_kubernetes/index.html, with appropriate changes to match CentOS and latest Kubernetes version.

./kube-up.sh script runs and exists with no errors and I don't see the server started on port 8080. Is there a way to know what was the error and if there is any other procedure to follow on CentOS 6.3

-- PMat
centos
centos6
kubernetes

1 Answer

5/3/2017

The easiest way to install the kubernetes cluster is using kubeadm. The initial post which details the steps of setup is here. And the detailed documentation for the kubeadm can be found here. With this you will get the latest released kubernetes.


If you really want to use the script to bring up the cluster, I did following:

Install the required packages

yum install -y git docker etcd

Start docker process

systemctl enable --now docker

Install golang Latest go version because default centos golang is old and for kubernetes to compile we need at least go1.7

curl -O https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.8.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

Setup GOPATH

export GOPATH=~/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

Download k8s source and other golang dependencies

Note: this might take sometime depending on your internet speed

go get -d k8s.io/kubernetes
go get -u github.com/cloudflare/cfssl/cmd/...

Start cluster

cd $GOPATH/src/k8s.io/kubernetes
./hack/local-up-cluster.sh

In new terminal

alias kubectl=$GOPATH/src/k8s.io/kubernetes/cluster/kubectl.sh
kubectl get nodes
-- surajd
Source: StackOverflow