How to Install Kubernetes on RHEL 7

How to Install Kubernetes on RHEL 7

Pull the RPMs

Enable or reposync the rhel-7-server-extras-rpms Yum repository

  1. subscription-manager repos --enable=rhel-7-server-extras-rpms

-or-

  1. reposync --repoid rhel-7-server-extras-rpms --arch=x86_64 --newest-only --download_path=/repo/
  2. createrepo /repo/rhel-7-server-extras-rpms
  3. find /repo/rhel7-server-extras-rpm -type f -exec chmod 644 {} ;
  4. find /repo/rhel7-server-extras-rpm -type d -exec chmod 755 {} ;

Install Dependencies (Docker, Git, Go, Mercurial)

  1. yum install docker, git, golang, mercurial
  2. systemctl enable docker
  3. systemctl start docker

Download & Install etcd

  1. cd /opt
  2. git clone https://github.com/coreos/etcd
  3. cd /opt/etcd/
  4. ./build
  5. ln -s /opt/etcd/bin/etcd /usr/local/bin/

Download godep

  1. cd /opt
  2. GOPATH=/opt/godep go get github.com/tools/godep
  3. ln -s /opt/godep/bin/godep /usr/local/bin/

Download Kubernetes

  1. cd /opt
  2. 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:

  1. touch /usr/share/rhel/secrets/rhel7.repo

Start Kubernetes

  1. /opt/kubernetes/hack/local-up-cluster.sh

Show what’s running in Kubernetes (nothing yet!)

Tell the client where the server is running

  1. sed -i -e s/^KUBERNETES_PROVIDER.*$/KUBERNETES_PROVIDER=“local”/’ /opt/kubernetes/cluster/kube-env.sh

List pods:

  1. /opt/kubernetes/cluster/kubecfg.sh list /pods

List services:

  1. /opt/kubernetes/cluster/kubecfg.sh list /services

List Replication Controllers:

  1. /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

原文地址:https://www.cnblogs.com/kevinX/p/5458177.html