k8s 1.23 安装kubesphere 3.4

 

参考 : https://blog.csdn.net/weixin_43810267/article/details/133347736

 

1、下载kubesphere的yaml

wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/kubesphere-installer.yaml
wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/kubesphere-installer.yaml

2、查看k8s集群有没有sc,分以下2种情况

情况一、没有sc则需要创建sc和2个pv

  • 创建sc
#创建存储类,先创建一个local-storage-class.yaml,然后写入一下内容
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

#创建StorageClass资源
kubectl apply -f local-storage-class.yaml
#查看StorageClass
kubectl get sc
  • 创建pv
vim my-pv.yml

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv1
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: local-storage
  nfs:
    path: /data/nfs/data3G
    server: 192.168.18.12

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv2
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: local-storage
  nfs:
    path: /data/nfs/data3G
    server: 192.168.18.12


#创建pv资源
kubectl apply -f my-pv.yaml
#查看pv
kubectl get pv
 

 

情况二、没有sc则需要创建nfs动态存储,https://www.cnblogs.com/lfxx/p/18069622

 

创建完sc后需要修改成默认的sc

kubectl patch storageclass local-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

 

3、安装kubeshepe

kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml

多次删除kubesphere后会报错Internal error occurred: failed calling webhook \"users.iam.kubesphere.io\": failed to call webhook:

参考:https://blog.csdn.net/weixin_42324368/article/details/135129262

解决方法运行kubectl delete validatingwebhookconfigurations `kubectl get validatingwebhookconfigurations|awk '{print $1}'`

 

4、查看kubesphere有没有安装成功

kubectl logs ks-installer-58f7c6477b-gdjhw -n kubesphere-system

 看到登录地址说明安装成功

 

PS:如果你要在主节点上安装kubesphere的话,还需要去除主节点上设置的taint(可以简单理解为允许pod在主节点调度)

#允许控制节点被调度
kubectl taint nodes --all node-role.kubernetes.io/control-plane-

问题1:端口已经被占用

 解决:杀掉本地占用端口的进程,k8s重启控制器

 

 

posted @ 2024-12-27 11:30  苦逼yw  阅读(3)  评论(0编辑  收藏  举报