How to Install Kubernetes on RHEL 7
Pull the RPMs
Enable or reposync
the rhel-7-server-extras-rpms
Yum repository
- subscription-manager repos --enable=rhel-7-server-extras-rpms
-or-
- reposync --repoid rhel-7-server-extras-rpms --arch=x86_64 --newest-only --download_path=/repo/
- createrepo /repo/rhel-7-server-extras-rpms
- find /repo/rhel7-server-extras-rpm -type f -exec chmod 644 {} ;
- find /repo/rhel7-server-extras-rpm -type d -exec chmod 755 {} ;
Install Dependencies (Docker, Git, Go, Mercurial)
- yum install docker, git, golang, mercurial
- systemctl enable docker
- systemctl start docker
Download & Install etcd
- cd /opt
- git clone https://github.com/coreos/etcd
- cd /opt/etcd/
- ./build
- ln -s /opt/etcd/bin/etcd /usr/local/bin/
Download godep
- cd /opt
- GOPATH=/opt/godep go get github.com/tools/godep
- ln -s /opt/godep/bin/godep /usr/local/bin/
Download Kubernetes
- cd /opt
- git clone https://github.com/GoogleCloudPlatform/kubernetes.git
Note: If your RHEL7 machine is not registered with the Red Hat network, you may get an error in your logs saying /usr/share/rhel/secrets/rhel7.repo
is not found. The workaround is to create the file as follows:
- touch /usr/share/rhel/secrets/rhel7.repo
Start Kubernetes
- /opt/kubernetes/hack/local-up-cluster.sh
Show what’s running in Kubernetes (nothing yet!)
Tell the client where the server is running
- sed -i -e ’s/^KUBERNETES_PROVIDER.*$/KUBERNETES_PROVIDER=“local”/’ /opt/kubernetes/cluster/kube-env.sh
List pods:
- /opt/kubernetes/cluster/kubecfg.sh list /pods
List services:
- /opt/kubernetes/cluster/kubecfg.sh list /services
List Replication Controllers:
- /opt/kubernetes/cluster/kubecfg.sh list /replicationControllers
Once you have this up and running, try deploying the GuestBook example: https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook