linux安裝KubeSphere
介紹
KubeSphere 是在目前主流容器調度平臺 Kubernetes 之上構建的企業級分布式多租戶容器平臺,提供簡單易用的操作界面以及向導式操作方式,在降低用戶使用容器調度平臺學習成本的同時,極大減輕開發、測試、運維的日常工作的復雜度,旨在解決 Kubernetes 本身存在的存儲、網絡、安全和易用性等痛點。除此之外,平臺已經整合并優化了多個適用于容器場景的功能模塊,以完整的解決方案幫助企業輕松應對敏捷開發與自動化運維、微服務治理、多租戶管理、工作負載和集群管理、服務與網絡管理、應用編排與管理、鏡像倉庫管理和存儲管理等業務場景。
KubeSphere安裝
先要安裝k8s
Kubernetes集群安裝
鯤鵬arm64架構下安裝KubeSphere
linux安裝部署k8s(kubernetes)和解決遇到的坑
在master節點上安裝k8s
hostnamectl set-hostname q-masterrebootsudo 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/dockersudo 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"
}
EOFsudo systemctl daemon-reloadsudo systemctl restart dockersudo setenforce 0sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config#關閉swap
swapoff -ased -ri 's/.*swap.*/#&/' /etc/fstab#允許 iptables 檢查橋接流量
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOFcat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOFsudo sysctl --systemcat <<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/hostskubeadm 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/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/configexport KUBECONFIG=/etc/kubernetes/admin.conf
安裝網絡插件
#安裝網絡插件
vi calico.yaml
kubectl apply -f calico.yamlkubectl get pod -Awatch -n 1 kubectl get pod -Ayum 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
安裝其他插件
vi default-storage.yaml
kubectl apply -f default-storage.yamlwatch -n 1 kubectl get pod -Avi metrics-server.yaml
kubectl apply -f metrics-server.yamlwatch -n 1 kubectl get pod -A
kubectl describe pod nfs-client-provisioner-df6455b66-d97z5
kubectl describe node q-masterkubectl 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
vi kubesphere-installer.yaml
apply -f kubesphere-installer.yaml
kubectl apply -f kubesphere-installer.yamlvi cluster-configuration.yaml
kubectl apply -f cluster-configuration.yamlvi cluster-configuration.yaml
rm -f cluster-configuration.yaml
vi cluster-configuration.yaml
kubectl apply -f cluster-configuration.yamlkubectl get pod -A
kubectl apply -f cluster-configuration.yaml
apply -f kubesphere-installer.yaml
kubectl apply -f kubesphere-installer.yamlrm -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}') -fkubectl get pod -A
kubectl get no
curl http://172.16.0.22:30880kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -fcurl 133.198.29.22:30880
curl 172.16.0.22:30880kubectl edit daemonset -n kube-system calico-node
kubectl get no
kubectl delete node edgenode-1kubectl 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