CentOS7 under Yum installation kubernetes

Source: Internet
Author: User
Tags etcd k8s

1. Node planning
Node Ip Hostname Hardware
Master 192.168.80.136 Master Memory 2G cpu:2*1
Node1 192.168.80.137 Node1 Memory 2G cpu:2*1
Node2 192.168.80.138 Node2 Memory 2G cpu:2*1
Etcd 192.168.80.139 Etcd Memory 2G cpu:2*1

2. System configuration (All machines)
  • Turn off SELinux
  • 0  /etc/selinux/config selinux=disabled
  • Shutting down and disabling the firewall

  • $ systemctl Disable FIREWALLD
  • Modify hostname
  • vi/ect/hostname# Four machines were modified to MASTERNODE1NODE2ETCD
  • Modify the Hosts file
  • $ vim/etc/hosts127.0. 0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4::1  localhost Localhost.localdomain localhost6 localhost6.localdomain6192.168. 80.136 Master 192.168. 80.137 Node1 192.168. 80.138 Node2 192.168. 80.139 Etcd
  • SSH Password-free login
  • $ ssh-keygen # All the way to the  default can be $ ssh-copy-id   {Other machine's IP}
  • Update Yum
$ yum Update
    • Installing related components
    • $ yum install-y etcd kubernetes NTP flannel
3, each node configuration
  • ETCD Server
  • # Modify config file $ vim/etc/etcd/etcd.conf Etcd_name=defaultEtcd_data_dir="/var/lib/etcd/default.etcd"Etcd_listen_client_urls="http://localhost:2379,http://192.168.80.139:2379"Etcd_advertise_client_urls="http://192.168.80.139:2379"# Start Service $ systemctl start ETCD $ systemctl enable etcd# check ETCD cluster status $ etcdctl cluster-Health member 8e9e05c52164694d isHealthy:got Healthy Result fromhttp//192.168.80.139:2379Cluster isHealthy

    # Set a key and the following will be used
    Etcdctl set/k8s/network/config ' {"Network": "10.255.0.0/16"} '
  • master server
  • # Configure kube-apiserver configuration file $ vim/etc/kubernetes/config Kube_logtostderr="--logtostderr=true"Kube_log_level="--v=0"Kube_allow_priv="--allow-privileged=false"Kube_master="--master=http://192.168.80.136:8080"$ vim/etc/kubernetes/apiserverkube_api_address="--insecure-bind-address=0.0.0.0"kube_etcd_servers="--etcd-servers=http://192.168.80.139:2379"kube_service_addresses="--SERVICE-CLUSTER-IP-RANGE=10.254.0.0/16"Kube_admission_control="--admission-control=alwaysadmit"Kube_api_args=""#配置kube-Scheduler configuration file Vim/etc/kubernetes/Scheduler Kube_scheduler_args="--address=0.0.0.0"# Start Service forSERVICESinchKube-apiserver Kube-controller-manager kube-Scheduler Dosystemctl Restart $SERVICESdone
  • Node1 node
  • # Configure Node1 network $ vim/etc/sysconfig/Flanneld flannel_etcd_endpoints="http://192.168.80.139:2379"Flannel_etcd_prefix="/k8s/network"flannel_options="--iface=ens33"# ENS is the currently available Internet Adapter Name # config Node1 kube-proxy$ Vim/etc/kubernetes/config Kube_logtostderr="--logtostderr=true"Kube_log_level="--v=0"Kube_allow_priv="--allow-privileged=false"Kube_master="--master=http://192.168.80.136:8080"$ vim/etc/kubernetes/Proxy Kube_proxy_args="--bind=address=0.0.0.0"# Configure Node1 kubelet$ vim/etc/kubernetes/Kubelet kubelet_address="--address=127.0.0.1"Kubelet_hostname="--hostname-override=node1"Kubelet_api_server="--api-servers=http://192.168.80.136:8080"Kubelet_pod_infra_container="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"Kubelet_args=""# start Node1 service forSERVICESinchFlanneld Kube-proxy Kubelet; Dosystemctl Restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done
  • Node2 node
  • # Configure Node2 network $ vim/etc/sysconfig/Flanneld flannel_etcd_endpoints="http://192.168.80.139:2379"Flannel_etcd_prefix="/k8s/network"flannel_options="--iface=ens33"# Configure Node2 kube-proxy$ Vim/etc/kubernetes/config Kube_logtostderr="--logtostderr=true"Kube_log_level="--v=0"Kube_allow_priv="--allow-privileged=false"Kube_master="--master=http://192.168.80.136:8080"$ vim/etc/kubernetes/Proxy Kube_proxy_args="--bind-address=0.0.0.0"# Configure Node2 kubelet$ vim/etc/kubernetes/Kubelet kubelet_address="--address=127.0.0.1"Kubelet_hostname="--hostname-override=node1"Kubelet_api_server="--api-servers=http://192.168.80.136:8080"Kubelet_pod_infra_container="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"Kubelet_args=""# start Node2 service forSERVICESinchFlanneld Kube-proxy Kubelet Docker; Dosystemctl Restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done
4. Testing
Get Nodesname      STATUS    AGEnode1     ready     55mnode2     ready     54m

5. Reference article:

55015284

Https://www.kubernetes.org.cn/3096.html

CentOS7 under Yum installation kubernetes

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.