kubenetes 入门系列安装之kubeadm安装
kubenetes 入门系列安装之kubeadm安装
k8s的安装有多种方式,如yum安装,kubeadm安装,kubemini安装,二进制安装(生产环境多采用此方式精确控制安装)等。本文是入门系列验证,之前进行过yum安装,可以查看文章《k8s入门系列之集群yum安装篇》 。这里进行kubeadm安装一次了解安装过程,真正的学习、测试环境和生产环境都不建议此方法,都建议yum安装或者二进制安装,这样才可以详细了解到k8s的工作原理和工作过程
1,关闭防火墙服务,避免与docker容器的防火墙规则冲突。
systemctl stop firewalld
systemctl disable firewalld
2,关闭selinux:
修改/etc/selinux/config为SELINUX=disabled
重启后配置生效。不建议临时关闭(setenfore 0),防止机器重启失效。
3,关闭swap:
临时关闭:
swapoff -a
永久关闭:
sed -i 's/.*swap.*/#&/' /etc/fstab
4,host定向,将机器内部主机名通信打通:
vi /etc/hosts
192.168.92.139 master
192.168.92.132 node1
5,master机器设置免密钥登陆其他两个node
ssh-keygen #生成密钥对 cd /root/.ssh/ ssh-copy-id -i id_rsa.pub node01 ssh-copy-id -i id_rsa.pub node02
6,配置ntp:
yum install ntpdate -y systemctl enable ntpdate.service systemctl start ntpdate.service 临时同步:ntpdate time7.aliyun.com 设置任务计划crontab -e: */30 * * * * /usr/sbin/ntpdate time7.aliyun.com >/dev/null 2>&1
7、设置内核,建议安装标准系统初始化进行(部分厂商的机器已经进行了默认参数优化)
echo "* soft nofile 65536">> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf echo "* soft nproc 65536" >> /etc/security/limits.conf echo "* hard nproc 65536" >> /etc/security/limits.conf echo "* soft memlock unlimited" >> /etc/security/limits.conf echo "* hard memlock unlimited" >> /etc/security/limits.conf
修正转发:
modprobe br_netfilter cat < < EOF > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF sysctl -p /etc/sysctl.d/k8s.conf
8,设置yum源
epel源: yum install -y epel-release #kubenetes yum源 ,采用阿里云 cat < /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 --------------------- #docker yum源 采用阿里云 wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum clean all && yum makecache fast
9,安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2 net-tools conntrack-tools wget vim ntpdate libseccomp libtool-ltdl
二,进行kubeadm 集群安装部署
1,组件安装
master节点安装etcd:
yum install etcd -y
systemctl restart etcd
systemctl enable etcd
由于采用外部 etcd,所以要在 master 节点安装 etcd服务,这里也是etcd是单节点。不管是etcd集群还是单机,或者是 http, https都可以,只要在 kubeadm 中配置好就行。
master和其他node:
yum install docker-ce kubelet kubeadm kubectl ipvsadm -y
systemctl restart kubelet
systemctl restart docker
systemctl enable kubelet
systemctl enable docker
2,kubeadm安装配置 kubenetes 1.12.2集群
本文来自博客园,作者:IT老登,转载请注明原文链接:https://www.cnblogs.com/nb-blog/p/10641776.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)