Kubernetes Cluster deployment

Source: Internet
Author: User
Tags etcd docker registry k8s

一. 环境搭建:

3 CENTOS7 hosts:
Master 192.168.1.140 deploys Etcd,kube-apiserver,kube-controller-manager,kube-scheduler 4 apps.
NODE01 192.168.1.31 Deployment Docker,kubelet, Kube-proxy 3 apps
NODE02 192.168.1.11 Deployment Docker,kubelet, Kube-proxy 3 apps

    1. modifies the hostname and IP, and the three host NICs are set to bridged mode, enabling networking.
    2. Modify the/etc/hosts file individually:
    3. Three sets the default zone for the firewall to trusted.
    4. All three have the selinux turned off.
    5. The
    6. installs Docker and starts. Since master also needs to do the registry warehouse, it also needs to install Docker.
    7. turn on route forwarding:

      Two. Implements the container interoperability between NODE01 and NODE02.
    8. node01 and Node02 create a new bridge and secure the bridge IP.
      Node01:
      Delete the bridge Docker0, create a new bridge Kbr0:

      New Network Bridge configuration file:

      New route file: Route-eth0,eth0 is the name of the network adapter on the Node1.

      Modify the Docker configuration file, add the-b=kbr0 parameter

      Reboot Restart the system for the bridge settings to take effect.
    9. do the same for NODE02:
      New bridge:

      New bridge Profile:

      Create route file:

      Modify Docker profile:

      Restart system reboot.
    10. after the system starts, view the network card information and routing information.

    11. verifies the interoperability of containers between two host hosts:
      Node01 runs a container on

      Node02:

      Inter-container ping:


      Three. Deploy the app on master:
    12. install ETCD.

      View Etcd profile:
    13. Modify Profile:
    14. start ETCD service:

      View service port number:
    15. Deploy K8s-master components (apiserver +controller-manager+scheduler)
      Install software:


      View profile:
    16. Modify Profile:

Kube_logtostderr//Log settings
Kube_log_kevel//Log level settings
Kube_allow_priv//Whether privileged containers are allowed to run
Kube_master//Master node address, mainly for replication controller and Scheduler and Kubelet can be found successfully apiserver



Kube_api_address//monitoring interface, if configured as 127.0.0.1 only listens to localhost, configured to 0.0.0.0 will listen to all interfaces, here configured to 0.0.0.0.
Kube_api_port= "--port=8080"//apiserver listening port, default 8080, without modification.
kubelet_port= "--kubelet_port=10250"//Kubelet listening port, default 10250, no need to modify
Kube_etcd_servers//Specify the address of the ETCD node
Kube_service_addresses//This is the IP network segment where the SERVICE will run in the future
kube_api_args= "--secure-port=0"//default is to require HTTPS secure communication, "--secure-port=0" does not require HTTPS secure communication
Note: It is necessary to note that the original Kube_admission_control default contains to be deleted, or start the API server when the error

    1. Start the service:

      To view the service port:

      Four Deploy node Host:
    2. Install Kubernetes-node Software:

      To view the configuration file:
    3. To modify a configuration file:




      Configuration Item Kubelet_pod_infra_container= "--pod-infra-container-image=registry.access.redhat.com/rhel7/ Pod-infrastructure:latest "function k8s a basic container is needed when creating pods, so node nodes should be able to connect to the network. You can also build a private warehouse, upload the pod-infrastructure:latest image to a private repository, and modify the address of this profile.
    4. Start the service:

      To view ports:
    5. Repeat the above operation on the NODE02 host.
    6. Check the node status on master:


      Five Building a private warehouse:
      Kubernetes Management Container If this is the first operation, there may be some waiting time, because the first download of images takes a while. If there is no Docker registry locally, make sure that the nodes have access to the Internet, so we can build a private warehouse that provides the required mirrors by a private warehouse.
      In this experimental environment, Kubernetes is used as registry.

    7. Import Image:
    8. Run a container based on a private warehouse image

      Local access to private repositories:
    9. Upload the image to a private warehouse.
      Images used after import to local:

      To label the underlying image:

      Modify the Docker configuration file on all three hosts, specifying the URL of the private warehouse.

      To restart the Docker service:

      Upload the image to a private repository and view:

      Test, download the image you just uploaded:

At this point, the cluster is completed.

Kubernetes Cluster deployment

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.