Installing Kubernetes 1.8.1 on centos 7 with flannel Prerequisites:- You should have at least two VMs (1 master and 1 slave) with you before creating cluster in order to test full functionality of k8s. Kubernetes can be installed and deployed using following methods: Minikube ( It is a single node kubernetes cluster) Kops ( Multi node kubernetes setup into AWS ) Kubeadm ( Multi Node Cluster in our own premises) In this article we will install latest version of Kubernetes 1.7 on CentOS 7 / RHEL 7 with kubeadm utility.
I am trying to install kubernetes on my centos 7 machine. added below yum repo. when I install the package its giving version 1.6 & 1.5.
unable to install the kubernetes package in my master server.
here is the report for api server.
repo added.
![Kubernetes installation on centos 7 Kubernetes installation on centos 7](/uploads/1/2/5/5/125537138/414505431.jpg)
how can I install 1.6 version. here is the error message.
ThanksSR
sfgroupssfgroups
2 Answers
For kubernetes 1.6.2 we need only these rpms. when we run the
kubeadm init
command. it starts other process automatically.
More info here:
ThanksSR
sfgroupssfgroups
You seem to have installed kubelet & kubectl 1.5.2 already.You can uninstall 1.5.2 and retry the install of 1.6.x.
Yum normally installs the latest version of a package, regardless of which repository provides it.In this case it has a conflicting package already installed.
Edit: Removed the Centos extras reference as it was out of context.
jkantihubjkantihub
Not the answer you're looking for? Browse other questions tagged kubernetescentos7 or ask your own question.
Note: This post updated on 28th April 2015 with updated installation steps.
Kubernetes is a system for managing containerized applications in a clustered environment. It provides basic mechanisms for deployment, maintenance and scaling of applications on public, private or hybrid setups. It also comes with self-healing features where containers can be auto provisioned, restarted or even replicated.
Kubernetes is still at an early stage, please expect design and API changes over the coming year. In this blog post, we’ll show you how to install a Kubernetes cluster with three minions on CentOS 7, with an example on how to manage pods and services.
Kubernetes Components
Kubernetes works in server-client setup, where it has a master providing centralized control for a number of minions. We will be deploying a Kubernetes master with three minions, as illustrated in the diagram further below.
Kubernetes has several components:
- etcd - A highly available key-value store for shared configuration and service discovery.
- flannel - An etcd backed network fabric for containers.
- kube-apiserver - Provides the API for Kubernetes orchestration.
- kube-controller-manager - Enforces Kubernetes services.
- kube-scheduler - Schedules containers on hosts.
- kubelet - Processes a container manifest so the containers are launched according to how they are described.
- kube-proxy - Provides network proxy services.
Deployment on CentOS 7
We will need 4 servers, running on CentOS 7.1 64 bit with minimal install. All components are available directly from the CentOS extras repository which is enabled by default. The following architecture diagram illustrates where the Kubernetes components should reside:
![Kubernetes kubeadm install Kubernetes kubeadm install](/uploads/1/2/5/5/125537138/514824153.png)
Prerequisites
- Disable iptables on each node to avoid conflicts with Docker iptables rules:
- Install NTP and make sure it is enabled and running:
Setting up the Kubernetes Master
The following steps should be performed on the master.
- Install etcd and Kubernetes through yum:
- Configure etcd to listen to all IP addresses inside /etc/etcd/etcd.conf. Ensure the following lines are uncommented, and assign the following values:
- Configure Kubernetes API server inside /etc/kubernetes/apiserver. Ensure the following lines are uncommented, and assign the following values:
- Start and enable etcd, kube-apiserver, kube-controller-manager and kube-scheduler:
- Define flannel network configuration in etcd. This configuration will be pulled by flannel service on minions:
- At this point, we should notice that nodes' status returns nothing because we haven’t started any of them yet:
Setting up Kubernetes Minions (Nodes)
The following steps should be performed on minion1, minion2 and minion3 unless specified otherwise.
- Install flannel and Kubernetes using yum:
- Configure etcd server for flannel service. Update the following line inside /etc/sysconfig/flanneld to connect to the respective master:
- Configure Kubernetes default config at /etc/kubernetes/config, ensure you update the KUBE_MASTER value to connect to the Kubernetes master API server:
- Configure kubelet service inside /etc/kubernetes/kubelet as below:
minion1:minion2:minion3: - Start and enable kube-proxy, kubelet, docker and flanneld services:
- On each minion, you should notice that you will have two new interfaces added, docker0 and flannel0. You should get different range of IP addresses on flannel0 interface on each minion, similar to below:
minion1:minion2:minion3: - Now login to Kubernetes master node and verify the minions’ status:
You are now set. The Kubernetes cluster is now configured and running. We can start to play around with pods.
Creating Pods (Containers)
To create a pod, we need to define a yaml file in the Kubernetes master, and use the kubectl command to create it based on the definition. Create a mysql.yaml file:
And add the following lines:
Create the pod:
It may take a short period before the new pod reaches the Running state. Verify the pod is created and running:
So, Kubernetes just created a Docker container on 192.168.50.132. We now need to create a Service that lets other pods access the mysql database on a known port and host.
Creating Service
At this point, we have a MySQL pod inside 192.168.50.132. Define a mysql-service.yaml as below:
Start the service:
You should get a 10.254.x.x IP range assigned to the mysql service. This is the Kubernetes internal IP address defined in /etc/kubernetes/apiserver. This IP is not routable outside, so we defined the public IP instead (the interface that connected to external network for that minion):
Let’s connect to our database server from outside (we used MariaDB client on CentOS 7):
That’s it! You should now be able to connect to the MySQL container that resides on minion2.
Check out the Kubernetes guestbook example on how to build a simple, multi-tier web application with Redis in master-slave setup. In a follow-up blog post, we are going to play around with Galera cluster containers on Kubernetes. Stay tuned!
References
- Creating a Kubernetes Cluster to Run Docker Formatted Container Images - https://access.redhat.com/articles/1353773
- Kubernetes Github - https://github.com/googlecloudplatform/kubernetes
- Persistent Installation of MySQL and WordPress on Kubernetes - https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/mysql-wordpress-pd