linux安装KubeSphere

linux安装KubeSphere

介绍

KubeSphere 是在目前主流容器调度平台 Kubernetes 之上构建的企业级分布式多租户容器平台,提供简单易用的操作界面以及向导式操作方式,在降低用户使用容器调度平台学习成本的同时,极大减轻开发、测试、运维的日常工作的复杂度,旨在解决 Kubernetes 本身存在的存储、网络、安全和易用性等痛点。除此之外,平台已经整合并优化了多个适用于容器场景的功能模块,以完整的解决方案帮助企业轻松应对敏捷开发与自动化运维、微服务治理、多租户管理、工作负载和集群管理、服务与网络管理、应用编排与管理、镜像仓库管理和存储管理等业务场景。

KubeSphere安装

先要安装k8s

Kubernetes集群安装

鲲鹏arm64架构下安装KubeSphere

linux安装部署k8s(kubernetes)和解决遇到的坑

在master节点上安装k8s

shell 复制代码
hostnamectl set-hostname q-master

reboot

sudo yum remove docker*

sudo yum install -y yum-utils

#配置docker的yum地址
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

#安装指定版本
sudo yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io-1.4.6

#启动&开机启动docker
systemctl enable docker --now

# docker加速配置
sudo mkdir -p /etc/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
   "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
   "exec-opts": ["native.cgroupdriver=systemd"],
   "log-driver": "json-file",
   "log-opts": {
      "max-size": "100m"
   },
   "storage-driver": "overlay2"
}
EOF

sudo systemctl daemon-reload

sudo systemctl restart docker

sudo setenforce 0

sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

#关闭swap
swapoff -a

sed -ri 's/.*swap.*/#&/' /etc/fstab

#允许 iptables 检查桥接流量
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

sudo sysctl --system

cat <<EOF | sudo tee /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

#安装 kubelet,kubeadm,kubectl
sudo yum install -y kubelet-1.20.9 kubeadm-1.20.9 kubectl-1.20.9

#启动kubelet
sudo systemctl enable --now kubelet

#所有机器配置master域名
echo "172.16.0.22  q-master" >> /etc/hosts

kubeadm init --apiserver-advertise-address=172.16.0.22 --control-plane-endpoint=q-master --image-repository registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images --kubernetes-version v1.20.9 --service-cidr=10.96.0.0/16 --pod-network-cidr=192.168.0.0/16

#执行成功后按提示执行
mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

export KUBECONFIG=/etc/kubernetes/admin.conf
安装网络插件
shell 复制代码
#安装网络插件
vi calico.yaml
kubectl apply -f calico.yaml

kubectl get pod -A

watch -n 1 kubectl get pod -A

yum install -y nfs-utils

# 在master 执行以下命令 
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports

# 执行以下命令,启动 nfs 服务;创建共享目录
mkdir -p /nfs/data

# 在master执行
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server

# 使配置生效
exportfs -r
#检查配置是否生效
exportfs
安装其他插件
shell 复制代码
vi default-storage.yaml
kubectl apply -f default-storage.yaml

watch -n 1 kubectl get pod -A

vi metrics-server.yaml
kubectl apply -f metrics-server.yaml

watch -n 1 kubectl get pod -A
kubectl describe pod nfs-client-provisioner-df6455b66-d97z5
kubectl describe node q-master

kubectl taint nodes node-role.kubernetes.io/master:NoSchedule-
kubectl taint nodes q-master node-role.kubernetes.io/master:NoSchedule-
watch -n 1 kubectl get pod -A
安装kubesphere
shell 复制代码
vi kubesphere-installer.yaml
apply -f kubesphere-installer.yaml
kubectl apply -f kubesphere-installer.yaml

vi cluster-configuration.yaml
kubectl apply -f cluster-configuration.yaml

vi cluster-configuration.yaml
rm -f cluster-configuration.yaml
vi cluster-configuration.yaml
kubectl apply -f cluster-configuration.yaml

kubectl get pod -A
kubectl apply -f cluster-configuration.yaml
apply -f kubesphere-installer.yaml
kubectl apply -f kubesphere-installer.yaml

rm -f cluster-configuration.yaml
vi cluster-configuration.yaml
kubectl apply -f cluster-configuration.yaml
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

kubectl get pod -A
kubectl get no
curl http://172.16.0.22:30880

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

curl 133.198.29.22:30880
curl 172.16.0.22:30880

kubectl edit daemonset -n kube-system calico-node
kubectl get no
kubectl delete node edgenode-1

kubectl edit daemonset -n kube-system calico-node
kubectl edit daemonset -n kube-system kube-proxy
kubectl edit daemonset -n kube-system nodelocaldns




参考链接:

https://blog.csdn.net/An1090239782/article/details/110038285

https://kubesphere.io/zh/docs/quick-start/minimal-kubesphere-on-k8s/

https://www.yuque.com/leifengyang/oncloud/gz1sls

相关推荐
chlk1239 小时前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑10 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件10 小时前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号20 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash1 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI1 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行2 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统