sealos4.1部署Kubernetes单机
安装命令
wget https://github.com/labring/sealos/releases/download/v4.1.0-rc3/sealos_4.1.0-rc3_linux_amd64.tar.gz && tar -zxvf sealos_4.1.0-rc3_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
执行sealos安装命令
sudo sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 --single
下载dashboard配置文件
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
vim recommended.yaml
#修改两处
kubectl apply -f recommended.yaml
使用命令查看哪个镜像拉取失败了手动拉取镜像即可!
kubectl describe pod dashboard-metrics-scraper-64bcc67c9c-g55jh -n kubernetes-dashboard
**默认,**基于安全原因,集群并不会在control-plane节点上部署Pods。如果你需要在control-plane上部署Pods,比如用于development的单主机集群,需要执行如下:
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
编辑dashboard-admin.yaml文件
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: kubernetes-dashboard
name: dashboard-admin
namespace: kubernetes-dashboard
kubectl apply -f dashboard-admin.yaml
编辑dashboard-admin-bind-cluster-role.yaml文件
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dashboard-admin-bind-cluster-role
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: dashboard-admin
namespace: kubernetes-dashboard
kubectl apply -f dashboard-admin-bind-cluster-role.yaml
查获pod 部署详情
kubectl -n kubernetes-dashboard describe pod dashboard-metrics-scraper-64bcc67c9c-g55jh
kubectl -n kubernetes-dashboard describe pod kubernetes-dashboard-5c8bd6b59-tpjhw
获取Dashboard Token
kubectl -n kubernetes-dashboard create token dashboard-admin