Kubernetes常用服务

来自ling
跳转至: 导航搜索

常用链接

Sealos Kubernetes之kubectl命令行工具简介、安装配置及常用命令

dashboard

https://blog.csdn.net/mushuangpanny/article/details/126944780

sealos run docker.io/labring/kubernetes-dashboard:v2.7.0 kubectl port-forward -n kubernetes-dashboard --address 0.0.0.0 svc/kubernetes-dashboard 8001:443

https://192.168.30.60:8001/

eyJhbGciOiJSUzI1NiIsImtpZCI6IkhXVXJwNzhvcUxWdXFHWDF0aVF2bktSV2RKcjZQSHliVktTMmhqeVk2TEkifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjcwODEwNTI4LCJpYXQiOjE2NzA4MDY5MjgsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJhZG1pbiIsInVpZCI6IjlmM2UzYTNmLTlmNDQtNGY4YS04YmFiLWExOTk0MGY3OWY3ZSJ9fSwibmJmIjoxNjcwODA2OTI4LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6YWRtaW4ifQ.BFB0sMbixVrKgZwcFlj17MPnDEvwTzi87RPNHPawWJRNPiclSiGfCvAoeA4bH4MKRK9JGw3O3KIVrKLRHS8WmNx0vQmp1YnBtL1oStTUAYbeTX7-RrwCgdXp0xRsu6psLEDOBPpKySlf8l0_j5Kl5HaaCXFGU0BlrU69_Ia-7IFQK3RqGOgu7Z1xE-HaiFTqWgKrwpZbmpgu7eHPMRi6YgwH1YcW1H-BqyszOo3ZKKsIEPW5EiJC-_vJhDY-nCFZVSE9zc-QhzZ9OBxfoj6zc-F9uXMjzmgHzxFQi7DOkVM38AYioFdD1yRgnVBsRrhugG3LR1I4HIl3LHb5JU-ejw

Kubesphere

https://kubesphere.com.cn/docs/v3.3/pluggable-components/devops/

https://blog.csdn.net/YangCheney/article/details/127655973

https://yanggc.blog.csdn.net/article/details/127073006

tee /root/kubesphere/storageclass.yaml <<-'EOF'
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
EOF

tee /root/kubesphere/persistentVolumeClaim.yaml <<-'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-pve
spec:
  accessModes:
     - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: local-storage

EOF


kubectl apply -f storageclass.yaml
kubectl apply -f persistentVolumeClaim.yaml

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

 sealos run labring/kubesphere:v3.3.1 # install kubesphere

 wget https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/kubesphere-installer.yaml
 wget https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/cluster-configuration.yaml
curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/offline-installation-tool.sh
curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/images-list.txt

chmod +x offline-installation-tool.sh
./offline-installation-tool.sh -s -l images-list.txt -d ./kubesphere-images

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

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


 kubectl get svc/ks-console -n kubesphere-system

# 查看configmap相关配置
kubectl get configmap kubesphere-config -n kubesphere-system -o yaml
# 如果有错误进行编辑configMap配置
kubectl edit configmap kubesphere-config -n kubesphere-system -o yaml
# 重启并重新加载installer
kubectl rollout restart deploy -n kubesphere-system ks-installer

Default StorageClass was not found

https://blog.csdn.net/bulinstar/article/details/125030244

https://kubernetes.io/zh-cn/docs/tasks/administer-cluster/change-default-storage-class/

kubectl get storageclass
kubectl patch storageclass local-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
kubectl patch storageclass <your-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
kubectl patch sc local -p '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "true"}}}'

卸载

https://kubesphere.com.cn/docs/v3.3/installing-on-kubernetes/uninstall-kubesphere-from-k8s/

sh kubesphere-delete.sh