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

相关推荐
AlfredZhao14 小时前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户97183563346620 小时前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪1 天前
linux 拷贝文件或目录到指定的位置
linux
摇滚侠2 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
bush42 天前
嵌入式linux学习记录十四、术语
linux·嵌入式
载数而行5202 天前
Linux 11 动态监控指令top
linux
不会C语言的男孩2 天前
Linux 系统编程 · 第 8 章:进程基础
linux·c语言
古城小栈2 天前
Unix 与 Linux 异同小叙
linux·服务器·unix
凡人叶枫2 天前
Effective C++ 条款42:了解 typename 的双重意义
java·linux·服务器·c++
2601_961875242 天前
决战申论100题2026|最新|范文
linux·容器·centos·debian·ssh·fabric·vagrant