github.com/enmand/kubernetes@v1.2.0-alpha.0/docs/getting-started-guides/centos/centos_manual_config.md (about) 1 <!-- BEGIN MUNGE: UNVERSIONED_WARNING --> 2 3 <!-- BEGIN STRIP_FOR_RELEASE --> 4 5 <img src="http://kubernetes.io/img/warning.png" alt="WARNING" 6 width="25" height="25"> 7 <img src="http://kubernetes.io/img/warning.png" alt="WARNING" 8 width="25" height="25"> 9 <img src="http://kubernetes.io/img/warning.png" alt="WARNING" 10 width="25" height="25"> 11 <img src="http://kubernetes.io/img/warning.png" alt="WARNING" 12 width="25" height="25"> 13 <img src="http://kubernetes.io/img/warning.png" alt="WARNING" 14 width="25" height="25"> 15 16 <h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2> 17 18 If you are using a released version of Kubernetes, you should 19 refer to the docs that go with that version. 20 21 <strong> 22 The latest 1.0.x release of this document can be found 23 [here](http://releases.k8s.io/release-1.0/docs/getting-started-guides/centos/centos_manual_config.md). 24 25 Documentation for other releases can be found at 26 [releases.k8s.io](http://releases.k8s.io). 27 </strong> 28 -- 29 30 <!-- END STRIP_FOR_RELEASE --> 31 32 <!-- END MUNGE: UNVERSIONED_WARNING --> 33 Getting started on [CentOS](http://centos.org) 34 ---------------------------------------------- 35 36 **Table of Contents** 37 38 - [Prerequisites](#prerequisites) 39 - [Starting a cluster](#starting-a-cluster) 40 41 ## Prerequisites 42 43 You need two machines with CentOS installed on them. 44 45 ## Starting a cluster 46 47 This is a getting started guide for CentOS. It is a manual configuration so you understand all the underlying packages / services / ports, etc... 48 49 This guide will only get ONE node working. Multiple nodes requires a functional [networking configuration](../../admin/networking.md) done outside of kubernetes. Although the additional Kubernetes configuration requirements should be obvious. 50 51 The Kubernetes package provides a few services: kube-apiserver, kube-scheduler, kube-controller-manager, kubelet, kube-proxy. These services are managed by systemd and the configuration resides in a central location: /etc/kubernetes. We will break the services up between the hosts. The first host, centos-master, will be the Kubernetes master. This host will run the kube-apiserver, kube-controller-manager, and kube-scheduler. In addition, the master will also run _etcd_. The remaining host, centos-minion will be the node and run kubelet, proxy, cadvisor and docker. 52 53 **System Information:** 54 55 Hosts: 56 57 ``` 58 centos-master = 192.168.121.9 59 centos-minion = 192.168.121.65 60 ``` 61 62 **Prepare the hosts:** 63 64 * Create virt7-testing repo on all hosts - centos-{master,minion} with following information. 65 66 ``` 67 [virt7-testing] 68 name=virt7-testing 69 baseurl=http://cbs.centos.org/repos/virt7-testing/x86_64/os/ 70 gpgcheck=0 71 ``` 72 73 * Install Kubernetes on all hosts - centos-{master,minion}. This will also pull in etcd, docker, and cadvisor. 74 75 ```sh 76 yum -y install --enablerepo=virt7-testing kubernetes 77 ``` 78 79 * Note * Using etcd-0.4.6-7 (This is temporary update in documentation) 80 81 If you do not get etcd-0.4.6-7 installed with virt7-testing repo, 82 83 In the current virt7-testing repo, the etcd package is updated which causes service failure. To avoid this, 84 85 ```sh 86 yum erase etcd 87 ``` 88 89 It will uninstall the current available etcd package 90 91 ```sh 92 yum install http://cbs.centos.org/kojifiles/packages/etcd/0.4.6/7.el7.centos/x86_64/etcd-0.4.6-7.el7.centos.x86_64.rpm 93 yum -y install --enablerepo=virt7-testing kubernetes 94 ``` 95 96 * Add master and node to /etc/hosts on all machines (not needed if hostnames already in DNS) 97 98 ```sh 99 echo "192.168.121.9 centos-master 100 192.168.121.65 centos-minion" >> /etc/hosts 101 ``` 102 103 * Edit /etc/kubernetes/config which will be the same on all hosts to contain: 104 105 ```sh 106 # Comma separated list of nodes in the etcd cluster 107 KUBE_ETCD_SERVERS="--etcd-servers=http://centos-master:4001" 108 109 # logging to stderr means we get it in the systemd journal 110 KUBE_LOGTOSTDERR="--logtostderr=true" 111 112 # journal message level, 0 is debug 113 KUBE_LOG_LEVEL="--v=0" 114 115 # Should this cluster be allowed to run privileged docker containers 116 KUBE_ALLOW_PRIV="--allow-privileged=false" 117 ``` 118 119 * Disable the firewall on both the master and node, as docker does not play well with other firewall rule managers 120 121 ```sh 122 systemctl disable iptables-services firewalld 123 systemctl stop iptables-services firewalld 124 ``` 125 126 **Configure the Kubernetes services on the master.** 127 128 * Edit /etc/kubernetes/apiserver to appear as such: 129 130 ```sh 131 # The address on the local server to listen to. 132 KUBE_API_ADDRESS="--address=0.0.0.0" 133 134 # The port on the local server to listen on. 135 KUBE_API_PORT="--port=8080" 136 137 # How the replication controller and scheduler find the kube-apiserver 138 KUBE_MASTER="--master=http://centos-master:8080" 139 140 # Port kubelets listen on 141 KUBELET_PORT="--kubelet-port=10250" 142 143 # Address range to use for services 144 KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" 145 146 # Add your own! 147 KUBE_API_ARGS="" 148 ``` 149 150 * Start the appropriate services on master: 151 152 ```sh 153 for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do 154 systemctl restart $SERVICES 155 systemctl enable $SERVICES 156 systemctl status $SERVICES 157 done 158 ``` 159 160 **Configure the Kubernetes services on the node.** 161 162 ***We need to configure the kubelet and start the kubelet and proxy*** 163 164 * Edit /etc/kubernetes/kubelet to appear as such: 165 166 ```sh 167 # The address for the info server to serve on 168 KUBELET_ADDRESS="--address=0.0.0.0" 169 170 # The port for the info server to serve on 171 KUBELET_PORT="--port=10250" 172 173 # You may leave this blank to use the actual hostname 174 KUBELET_HOSTNAME="--hostname-override=centos-minion" 175 176 # Location of the api-server 177 KUBELET_API_SERVER="--api-servers=http://centos-master:8080" 178 179 # Add your own! 180 KUBELET_ARGS="" 181 ``` 182 183 * Start the appropriate services on node (centos-minion). 184 185 ```sh 186 for SERVICES in kube-proxy kubelet docker; do 187 systemctl restart $SERVICES 188 systemctl enable $SERVICES 189 systemctl status $SERVICES 190 done 191 ``` 192 193 *You should be finished!* 194 195 * Check to make sure the cluster can see the node (on centos-master) 196 197 ```console 198 $ kubectl get nodes 199 NAME LABELS STATUS 200 centos-minion <none> Ready 201 ``` 202 203 **The cluster should be running! Launch a test pod.** 204 205 You should have a functional cluster, check out [101](../../../docs/user-guide/walkthrough/README.md)! 206 207 208 <!-- BEGIN MUNGE: GENERATED_ANALYTICS --> 209 [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/centos/centos_manual_config.md?pixel)]() 210 <!-- END MUNGE: GENERATED_ANALYTICS -->