Kubernetes cluster configuration notes

Source: Internet
Author: User
Tags etcd

Kubernetes cluster configuration notes

This article describes how to configure a Kubernetes cluster. A kubernetes cluster consists of a master node and a slave node.

Run the following services on the Master node:
Etcd (the etcd service can also be run independently, not necessarily on the Master node)
Kube-apiserver
Kube-controller-manager
Kube-scheduler
Kubelet
Kube-proxy

Run the following services on the Slave node:
Kubelet
Kube-proxy

I. Environment Introduction
Operating system version: CentOS linux 7.2 64bit
Master node: 192.168.115.5/24 vm1
Slave Node 1: 192.168.115.6/24 vm2
Install Kubernets and etcd using yum
Kubernets version: 1.5.2
Etcd version: 2.2.5

Ii. Master node configuration

# Yum-y install kubernetes etcd

1. General configuration file

# Grep-v '^ #'/etc/kubernetes/config
KUBE_LOG_LEVEL = "-- v = 0"
KUBE_ALLOW_PRIV = "-- allow-privileged = false"
KUBE_MASTER = "-- master = http: // 192.168.115.5: 8080" // apiserver address

2. apiserver configuration file

# Grep-v '^ #'/etc/kubernetes/apiserver
KUBE_API_ADDRESS = "-- insecure-bind-address = 0.0.0.0" // The listening address of the apiserver
# KUBE_API_PORT = "-- port = 8080" // listener port of the apiserver
# KUBELET_PORT = "-- kubelet-port = 10250" // monitoring port of the kubelet Service
KUBE_ETCD_SERVERS = "-- etcd-servers = http: // 0.0.0.0: 2379" // address of the etcd Service
KUBE_SERVICE_ADDRESSES = "-- service-cluster-ip-range = 10.254.0.0/16" // CIDR Block of the cluster service
KUBE_ADMISSION_CONTROL = "-- admission-control = NamespaceLifecycle, NamespaceExists, LimitRanger, SecurityContextDeny, ResourceQuota" // to avoid user authentication, the ServiceAccount parameter is canceled.
KUBE_API_ARGS = ""

3. The controller-manager configuration file does not require special configuration.

# Cat/etc/kubernetes/controller-manager

4. etcd configuration file

# Grep-v '^ #'/etc/etcd. conf
ETCD_NAME = default
ETCD_DATA_DIR = "/var/lib/etcd/default. etcd"
ETCD_LISTEN_CLIENT_URLS = "http: // 0.0.0.0: 2379" // listener address and port
ETCD_ADVERTISE_CLIENT_URLS = "http: // 0.0.0.0: 2379" // cluster service listening address and port

5. General configuration file

# Grep-v '^ #'/etc/kubernetes/config
KUBE_LOGTOSTDERR = "-- logtostderr = true"
KUBE_LOG_LEVEL = "-- v = 0"
KUBE_ALLOW_PRIV = "-- allow-privileged = false"
KUBE_MASTER = "-- master = http: // 192.168.115.5: 8080" // apiserver address and port of the master service

6. kubelet service configuration file

# Grep-v '^ #'/etc/kubernetes/kubelet
KUBELET_ADDRESS = "-- address = 192.168.115.7" // slave listening address
KUBELET_HOSTNAME = "-- hostname-override = 192.168.115.7" // Server Load balancer Host Name
KUBELET_API_SERVER = "-- api-servers = http: // 192.168.115.5: 8080" // apiserver address and port of the master service
KUBELET_POD_INFRA_CONTAINER = "-- pod-infra-container-image = gcr. io/google_containers/pause" // The pull address of the image needed to start the kubenet Service
KUBELET_ARGS = ""

7. kube-proxy configuration file, which generally does not require special configuration

# Cat/etc/kubernetes/proxy

Iii. Slave node configuration

# Yum-y install kubernetes

1. General configuration file

# Grep-v '^ #'/etc/kubernetes/config
KUBE_LOGTOSTDERR = "-- logtostderr = true"
KUBE_LOG_LEVEL = "-- v = 0"
KUBE_ALLOW_PRIV = "-- allow-privileged = false"
KUBE_MASTER = "-- master = http: // 192.168.115.5: 8080" // apiserver address and port of the master service

2. kubelet service configuration file

# Grep-v '^ #'/etc/kubernetes/kubelet
KUBELET_ADDRESS = "-- address = 192.168.115.7" // slave listening address
KUBELET_HOSTNAME = "-- hostname-override = 192.168.115.7" // Server Load balancer Host Name
KUBELET_API_SERVER = "-- api-servers = http: // 192.168.115.5: 8080" // apiserver address and port of the master service
KUBELET_POD_INFRA_CONTAINER = "-- pod-infra-container-image = gcr. io/google_containers/pause" // The pull address of the image needed to start the kubenet Service
KUBELET_ARGS = ""

3. kube-proxy configuration file, which generally does not require special configuration

# Cat/etc/kubernetes/proxy

4. Start the service
1. master node

# Systemctl start etcd
# Systemctl start kube-apiserver
# Systemctl start kube-controller-manager
# Systemctl start kube-scheduler
# Systemctl start kubelet
# Systemctl start kube-proxy

2. slave Node

# Systemctl start kubelet
# Systemctl start kube-proxy

5. Verify that the cluster is working properly

# Kubectl get nodes // run on the master node
# Kubectl cluster-info

6. Import a pause image
This image is the root container image of k8s and needs to be downloaded through scientific Internet access. Therefore, the local import method is used after the download is complete.

# Docker load <pause.tar

This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151136.htm

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.