安装 kubernetes
0. 准备工作
- Centos7
- CPU:最低要求,1 CPU 2 核
- 内存:最低要求,2GB
- 磁盘:最低要求,20GB
0. 准备
0.1 关闭交换空间
sudo swapoff -a
#避免开机启动交换空间:注释 /etc/fstab 中的 swap
0.2 修改主机名
hostnamectl set-hostname kb-master
hostnamectl
#显示以下信息
#Static hostname: kb-master
# Icon name: computer-vm
# Chassis: vm
0.3 关闭 selinux
#设置宽松模式
setenforce 0
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
0.4 关闭 selinux
#配置host
192.168.0.99 k8s-master
192.168.0.98 k8s-node1
0.5 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
0.6 安装docker
https://www.runoob.com/docker/centos-docke...
1. 使用阿里镜像
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF
2. 安装
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet
systemctl start kubelet
kubeadm version
# 输出一下信息
#kubeadm version: &version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.1", #GitCommit:"d647ddbd755faf07169599a625faf302ffc34458", GitTreeState:"clean", BuildDate:"2019-10-#02T16:58:27Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: