Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install kubernetes1.6 under ubuntu 16.04

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install kubernetes1.6 under ubuntu 16.04. the editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

1 introduction to kubernetes

Kubernetes is a cluster management system that provides a set of components to manage containers. Kubernetes can easily manage containers running across hosts, and can maintain and extend containers.

2 kubernetes core components Masterside components

2.1 apiserver

The entrance of kubernetes system encapsulates the operation of adding, deleting, modifying and querying core objects, and provides it to external customers and internal components in the way of RESTFul interface. The REST objects it maintains will be persisted to etcd (a distributed, highly consistent key/value storage)

2.2 controller-manager

Responsible for the implementation of various controllers, there are currently two types:

Endpoint-controller: associate service and pod periodically (the association information is maintained by the endpoint object) to ensure that the service-to-pod mapping is always up to date.

Replication-controller: associate replicationController and pod periodically to ensure that the number of replications defined by replicationController is always the same as the actual number of pod running.

2.3 scheduler

Responsible for resource scheduling of the cluster, assigning machines to the newly built pod

2.4 etcd

Provide persistent storage of information such as pod,services

Minion-side components

2.5 kubelet

Responsible for managing and controlling docker containers, such as starting / stopping, monitoring running status, etc. It periodically fetches the pod assigned to the machine from etcd and starts or stops the corresponding container based on the pod information. At the same time, it will also receive HTTP requests from apiserver to report the running status of pod.

2.6 kube-proxy

Responsible for providing agents for pod. It periodically fetches all service from etcd and creates proxies based on service information. When a customer pod wants to access another pod, the access request is forwarded through the native proxy.

3 basic operation object 3.1 pod

The most basic deployment scheduling unit of Kubernetes, which can contain one or more container, logically represents an instance of an application. For example, a web site application is built from a front-end, back-end, and database, and these three components will run in their own containers, so we can create a pod with three container.

3.2 service

Is the routing agent abstraction of pod to solve the problem of service discovery between pod. Because the running status of pod can be changed dynamically (such as switching machines, being terminated during downsizing, etc.), the access side cannot access the services provided by the pod by writing a dead IP. The introduction of service is to ensure that the dynamic changes of pod are transparent to the access side. The access side only needs to know the address of the service, and service provides the proxy.

3.3 replicationController

It is the replication abstraction of pod, which is used to solve the problem of capacity expansion and reduction of pod. Usually, for the sake of performance or high availability, distributed applications need to replicate multiple resources and dynamically scale according to the load. With replicationController, we can specify how many replicas an application needs, and Kubernetes will create a pod for each copy and ensure that the actual number of pod running is always equal to that number of replicas (for example, when a current pod goes down, a new pod is automatically created to replace it).

Service and replicationController are just abstractions based on pod that ultimately work on pod, so how do they relate to pod? This introduces the concept of label: label is to add a set of key/value tags to pod that can be used for search or association, and service and replicationController are associated with pod through label. When you create service and replicationController, you can specify the same label: "xxx=yyy", and then associate them with the three pod through the label selector mechanism.

4 kubernetes installation 4.1 Environment preparation

4.2 implement the network model of kubernetes with openvswitch GRE

Using openvswitch GRE Channel to realize Container Communication between hosts

Do the following on 192.168.100.92 and 192.168.100.93, respectively

Install openvswitch,bridge-utils,docker

Apt-get install openvswitch-switch bridge-utils docker-engine

Establish ovs bridge

Ovs-vsctl add-br obr0

Create a gre and add the newly created gre0 to the obr0

Ovs-vsctl add-port obr0 gre0-set Interface gre0 type=gre options:remote_ip=192.168.100.93

Change remote_ip=192.168.100.93 to remote_ip=192.168.100.92 on 192.168.100.93

Create linux bridge

Brctl addbr kbr0

Add an interface with obr0 as kbr0

Brctl addif kbr0 obr0

Set docker0 to down statu

Ip link set dev docker0 down

Delete docker0

Ip link del dev docker0

To make the kbr0 permanent, add the following statement in / etc/network/interfaces

Auto kbr0

Iface kbr0 inet static

Address 172.17.1.1

Netmask 255.255.255.0

Dns-nameservers 8.8.8.8

Up route add-net 172.17.2.0 dev enp0s3 24 gw 192.168.100.93

In / etc/network/interfaces of 192.168.100.93, add the following statement

Auto kbr0

Iface kbr0 inet static

Address 172.17.2.1

Netmask 255.255.255.0

Dns-nameservers 8.8.8.8

Up route add-net 172.17.1.0 gw 24 dev enp0s3 192.168.100.92

Turn on ip_forward

Open in / etc/sysctl.conf

Net.ipv4.ip_forward=1

Sysctl-p

Ping 172.17.2.1 on 192.168.100.92 and ping 172.17.1.1 on 192.168.100.93. If you can ping each other, the GRE channel has been connected.

This is the end of this article on "how to install kubernetes1.6 under ubuntu 16.04". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report