以下内容仅供个人测试学习k8s使用,不能直接用于生产环境
下载Docker desktop

Docker中文网 官网

部署本机K8s

点击右上角设置->Kubernetes->Enable两个标签->apply

等待几分钟,可以看到docker上启动了很多k8s相关的镜像

控制台查看是否成功

配置k8s dashborad

以下参考部署和访问 Kubernetes 仪表板(Dashboard) | Kubernetes

执行:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

如果没卡住,就跳过下面这一小段,有的人会卡住,不慌,浏览器访问:

https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

复制浏览器所有内容,本地创建一个文件,名字随便命名,后缀是yaml,保存到本地,然后继续执行上面的命令 url地址换成这里新创建的文件地址和名字,我这里设置成a.yaml

kubectl apply -f /Users/a1234/Desktop/a.yaml

等待一会,然后终端继续执行:

kubectl proxy

此时尝试访问:http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/如果不通等一会再试试

如果成功会进入此页面:

创建账号

演示创建一个登陆dashboard的admin-user的账号:

先将以下两块内容保存成两个文件 b.yaml和c.yaml

apiVersion: v1

kind: ServiceAccount

metadata:

name: admin-user

namespace: kubernetes-dashboard

apiVersion: rbac.authorization.k8s.io/v1

kind: ClusterRoleBinding

metadata:

name: admin-user

roleRef:

apiGroup: rbac.authorization.k8s.io

kind: ClusterRole

name: cluster-admin

subjects:

- kind: ServiceAccount

name: admin-user

namespace: kubernetes-dashboard

然后终端依次输入

kubectl apply -f /Users/a1234/Desktop/b.yaml

kubectl apply -f /Users/a1234/Desktop/c.yaml

登陆dashborad

此时终端继续输入

kubectl -n kubernetes-dashboard create token admin-user

获取到一大段字幕,复制输入到token栏中(注意,如果输入提示错误,可以刷新一下页面再试)

这样就进入到dashborad页面了

GitHub 加速计划 / da / dashboard
14.17 K
4.13 K
下载
General-purpose web UI for Kubernetes clusters
最近提交(Master分支:3 个月前 )
9a476333 Bumps [jest-preset-angular](https://github.com/thymikee/jest-preset-angular) from 14.2.0 to 14.2.2. - [Release notes](https://github.com/thymikee/jest-preset-angular/releases) - [Changelog](https://github.com/thymikee/jest-preset-angular/blob/main/CHANGELOG.md) - [Commits](https://github.com/thymikee/jest-preset-angular/compare/v14.2.0...v14.2.2) --- updated-dependencies: - dependency-name: jest-preset-angular dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 3 个月前
11b7e82e Bumps [cypress](https://github.com/cypress-io/cypress) from 13.13.1 to 13.13.2. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md) - [Commits](https://github.com/cypress-io/cypress/compare/v13.13.1...v13.13.2) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐