1. 程式人生 > 其它 >kubernetes安裝部署--基於kubeadmin部署單機版本

kubernetes安裝部署--基於kubeadmin部署單機版本

 

部署過程

1、部署架構

2、部署前準備

  系統環境準備

#關閉交換分割槽
swapoff -a
echo "swapoff -a" >> /etc/rc.local
#關閉防火牆
systemctl disable firewalld
systemctl stop firewalld
#關閉selinux
setenforce 0
sed -i '/^SELINUX/s/enforcing/disabled/' /etc/selinux/config
#配置kubernetes下載地址
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=0 EOF #安裝kubernetes工具。node節點可以不需要安裝kubectl yum install -y yum-utils device-mapper-persistent-data lvm2 kubelet kubeadm kubectl net-tools #配置iptables轉發 cat > /etc/sysctl.d/k8s.conf << EOF net.bridge.bridge
-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF
View Code

  host檔案準備

[root@master ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.11 master
192.168.1.12 node01
192.168.1.13 node02
View Code

3、映象準備

  檢視當前kubeamd預設支援的映象版本號:kubeadm config images list

[root@master ~]# kubeadm config images list
k8s.gcr.io/kube-apiserver:v1.23.5
k8s.gcr.io/kube-controller-manager:v1.23.5
k8s.gcr.io/kube-scheduler:v1.23.5
k8s.gcr.io/kube-proxy:v1.23.5
k8s.gcr.io/pause:3.6
k8s.gcr.io/etcd:3.5.1-0
k8s.gcr.io/coredns/coredns:v1.8.6
View Code

可從阿里面官網上下載(目前只儲存了這一個版本)

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/kube-apiserver:v1.23.5

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/kube-proxy:v1.23.5

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/kube-controller-manager:v1.23.5

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/kube-scheduler:v1.23.5

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/coredns:v1.8.6

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/etcd:3.5.1-0

docker pull registry.cn-shenzhen.aliyuncs.com/lmgsanm_k8s/pause:3.6

4、部署