Docker Practice (6) Deploy kubernetes on-centos7

Source: Internet
Author: User
Tags etcd cadvisor

Kubernetes Architecture

The overall architecture of the kubernetes is as follows:

Master is the main control node, which runs Apiserver,scheduler,controller-manager and other components. Minion is the equivalent of a working node, which runs Kubelet,proxy,cadvisor and the most important Docker components. Here's how to actually deploy this cluster management tool.

Environment

Yy1 10.193.6.35

Yy2 10.193.6.36

Yy1 as master,yy2 as minion.

# Cat/etc/centos-release

CentOS Linux release 7.0.1406 (Core)

Installing Kubernetes
# Curl HTTPS://copr.fedoraproject.org/coprs/eparis/kubernetes-epel-7/repo/epel-7/ Eparis-kubernetes-epel-7-epel-7.repo-o/etc/yum.repos.d/eparis-kubernetes-epel-7-epel-7.repo   YumInstall kubernetes-y

Configure Yy1
#Cat/etc/kubernetes/apiserver#### kubernetes System config## The following values is used to configure the Kubernetes-apiserver# # The address on the local server to listen. Kube_api_address="10.193.6.35"# The port is on the local server to listen. Kube_api_port="8080"# How the replication controller and schedulerFindThe apiserverkube_master="10.193.6.35:8080"# Comma seperated List of minionsminion_addresses="10.193.6.36"# Port Minions listen Onminion_port="10250" # Cat/etc/kubernetes/config#### kubernetes System config## The following values is used to configure various aspects of all# kubernetes SE Rvices, including## kubernetes-apiserver.service# kubernetes-controller-manager.service# kubernetes-kubelet.service# kubernetes-Proxy.service # Comma seperated List of nodesinchThe etcd clusterkube_etcd_servers="http://10.193.6.35:4001"# Logging to stderr means we get itinchThe systemd journalkube_logtostderr="true"# Journal message level,0is debugkube_log_level=0# Should this cluster is allowed to run privleged Docker Containerskube_allow_priv="true"

Start related services on yy1

You need to run the Etcd,kube-apiserver,kube-controller-manager,kube-scheduler 4 processes on master.

 for inch  Do     systemctl Restart $SERVICES    systemctl enable $SERVICES    systemctl status $SERVICESdone 

Configure Yy2
1#Cat/etc/kubernetes/Kubelet2 3 ###4 5 # kubernetes Kublet (Minion) config6 7  8 9# The Address forTheInfoserver to serve onTen  Oneminion_address="10.193.6.36" A  -   -  the# The Port forTheInfoserver to serve on -  -minion_port="10250" -  +   -  +# Leave this blank to use the actualhostname A  atMinion_hostname="10.193.6.36" -  -   -  -#Cat/etc/kubernetes/Config -  in ### -  to # kubernetes System config +  - # the  * # The following values is used to configure various aspects of all $ Panax Notoginseng # kubernetes Services, including -  the # +  A# kubernetes-Apiserver.service the  +# kubernetes-controller-Manager.service -  $# kubernetes-Kubelet.service $  -# kubernetes-Proxy.service -  the   - Wuyi# Comma seperated List of nodesinchThe etcd cluster the  -kube_etcd_servers="http://10.193.6.35:4001" Wu  -   About  $# Logging to stderr means we get itinchThe systemd Journal -  -Kube_logtostderr="true" -  A   +  the# Journal message level,0is debug -  $Kube_log_level=0 the  the   the  the # Should this cluster is allowed to run privleged Docker containers -  inkube_allow_priv="true"

Modify the configuration of the Yy2 Kubelet

There is no Docker.socket service on CentOS7, comment out the dependency on Docker.socket in Kubelet.

/usr/lib/systemd/system/kubelet.service

1 [Unit] 2 3 description=Kubernetes kubelet  4  5 #After =docker.socket cadvisor.service  6  7 after=cadvisor.service  8  9 #Requires =docker.socket Cadvisor.service requires=cadvisor.service

Start related services on the Yy2

You need to run Kube-proxy,kubelet and Docker on the minion.

 for inch  Do      systemctl Restart $SERVICES    systemctl enable $SERVICES    done

To create a pod description file

Create an Apache pod description file.

#Catapache.json{"ID":"Apache",  "desiredstate": {    "Manifest": {      "version":"v1beta1",      "ID":"apache-1",      "Containers": [{        "name":"Master",        "Image":"Fedora/apache",        "Ports": [{          "Containerport": the,          "Hostport": the        }]      }]    }  },  "Labels": {    "name":"Apache"  }}

Create pod

By submitting a task to apiserver through the client tool Kubecfg, a Minion deployment capacity is selected by scheduler.

[Email protected] ~]# kubecfg-c Apache.json Create podsI0925 .: +:26.768122 09313Request.go:292] Waiting forCompletion of/operations/1ID Image (s) Host Labels Status----------          ----------          ----------          ----------          ----------Apache Fedora/apache/name=Apache waiting [[email protected]~]# kubecfg list pods ID Image (s) Host Labels Status----------          ----------          ----------          ----------          ----------Apache Fedora/apache10.193.6.36/Name=apache Waiting

The Apache service automatically deploys to Docker on the machine yy2,yy2 automatically downloads the image and then launches the Apache service. Well, after a while, the Apache service will get up on the yy2.

[Email protected] ~]# kubecfg list pods  ID                  Image (s)            Host                Labels              Status----------          ----------          ----------          ----------          ----------Apache              Fedora/apache       10.193.  6.36/        name=apache         Running

You can try to access it,

Main references

Https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/fedora/fedora_manual_config.md


YY Brother
Source: http://www.cnblogs.com/hustcat/
This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

Docker Practice (6) Deploy kubernetes on-centos7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.