Kubernetes之kubeadm安装.md

  • 环境: Centos7, Kubernetes 1.11.2, docker-ce 17.03

Foreward

Kubernetes安装文档.

这里是一些安装软件的

  • kubeadm: the command to bootstrap the cluster.

  • kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers.

  • kubectl: the command line util to talk to your cluster.

Install

Prepare

添加yum仓库配置文件

官方推荐的使用的packages.cloud.google.com地址不通,这里使用阿里云的yum仓库.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

$ cat <<EOF > /etc/yum.repos.d/kubernetes.repo

[kubernetes]

name=Kubernetes

baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64

enabled=1

gpgcheck=0

repo_gpgcheck=0

gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

EOF

关闭SELinux

1
2
3
4
5
6
7
8
9
10

# 临时关闭

$ setenforce 0

# 保证下次机器重启时生效.

$ vim /etc/selinux/config

SELINUX=disabled

网络设置

1
2
3
4
5
6
7
8
9
10

$ vim cat <<EOF > /etc/sysctl.d/k8s.conf

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

EOF

$ sysctl --system

关闭系统swap

1
2

$ swapoff -a && sysctl -w vm.swappiness=0

安装docker

此处忽略,查看docker官方安装教程即可.

Install Master

1
2
3
4

$ yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

$ systemctl enable kubelet && systemctl start kubelet
坚持原创技术分享,您的支持将鼓励我继续创作!
Fork me on GitHub