企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 镜像的准备 * [超大库](https://hub.docker.com/r/mritd/) * #### 拉取google指定镜像`kubernetes-dashboard-amd64` > 周所周知的情况,一堵墙导致一些镜像是无法直接下载的,提示如下类似信息。 ```powershell $sudo docker pull gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1 Trying to pull repository gcr.io/google_containers/kubernetes-dashboard-amd64 ... Pulling repository gcr.io/google_containers/kubernetes-dashboard-amd64 Network timed out while trying to connect to http://gcr.io/v1/repositories/google_containers/kubernetes-dashboard-amd64/images. You may want to check your internet connection or if you are behind a proxy. ``` * #### 寻找到能在dockerhub下载到的可替换镜像 ```powershell $ sudo docker pull mritd/kubernetes-dashboard-amd64 ``` > 下载后的镜像tag如下 ![](https://box.kancloud.cn/60c9c928199a106091e7d99dd92cd623_1273x365.png) ## yaml文件 * vi `dashboard-deployment.yaml` ![](https://box.kancloud.cn/69f8a25ee904deef80c30054676480a4_1004x637.png) ```yaml apiVersion: extensions/v1beta1 kind: Deployment metadata: name: kubernetes-dashboard-latest namespace: kube-system spec: replicas: 1 template: metadata: labels: k8s-app: kubernetes-dashboard version: latest kubernetes.io/cluster-service: "true" spec: containers: - name: kubernetes-dashboard image: docker.io/mritd/kubernetes-dashboard-amd64 resources: limits: cpu: 100m memory: 50Mi requests: cpu: 100m memory: 50Mi ports: - containerPort: 9090 args: - --apiserver-host=http://192.168.33.103:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 ``` * vi `dashboard-service.yaml` ![](https://box.kancloud.cn/5725e89f8cff97fe1d766d118e34ce64_559x261.png) ![选区_077](/home/hzy/file/notes/images/选区_077.png) ```yaml apiVersion: v1 kind: Service metadata: name: kubernetes-dashboard namespace: kube-system labels: k8s-app: kubernetes-dashboard kubernetes.io/cluster-service: "true" spec: selector: k8s-app: kubernetes-dashboard ports: - port: 80 targetPort: 9090 ``` ## 启动服务 ```powershell # deployment $ kubectl create -f dashboard-deployment.yaml deployment "kubernetes-dashboard-latest" created # 因为yaml文件指定的namespace是kube-system,因此得指定。 $ kubectl get pod -n kube-system NAME READY STATUS RESTARTS AGE kubernetes-dashboard-latest-1910469837-1rdff 1/1 Running 0 54s # service $ kubectl create -f dashboard-service.yaml service "kubernetes-dashboard" created $ kubectl get services -n kube-system NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard 10.254.21.182 <none> 80/TCP 9s ``` ## 访问UI > http://ip-addr:8080/ui ![](https://box.kancloud.cn/645bfb307f988b35297e2c32674fe273_1863x961.png) ![选区_078](/home/hzy/file/notes/images/选区_078.png)