Kubernetes(k8s)中dashboard的部署。
2021-02-01 14:16
标签:initial names git dem extension complete not ready 编辑 1、k8s的dashboard的安装部署,首先需要将压缩包下载下来,然后进行解压缩操作。 查看配置文件dashboard-deploy.yaml,并对配置进行修改。 首先,需要将kubernetes-dashboard-amd64下载下来,然后上传到私有仓库里面,方便使用。 dashboard-deploy.yaml,对配置进行修改,具体内容,如下所示。 修改的地方,如下所示:
配置完毕,创建deployment,如下所示: 修改dashboard-svc.yaml配置文件,其中port是VIP的端口,targetPort是容器的端口,访问vip的端口80就会跳转到targetPort的9090端口。 [root@k8s-master dashboard]# vim dashboard-svc.yaml 开始创建svc,命令如下所示: 创建完毕,查看是否已经正常启动了。 此时,就可以进行访问了,服务已经Running了。 2、首先,可以访问一下api-server,可以使用8080端口号。访问地址http://192.168.110.133:8080/。
接下来访问倒数第二行的/ui/,访问的效果,如下所示: 报错,如下所示: 这里查看k8s的版本,使用kubectl version。 注意:k8s v1.5 web界面,kubernetes-dashboard v1.5 ,k8s的安装版本和kubernetes-dashboard的版本对应,此时对k8s了解还不是很深,只能一点点摸索了。 kubernetes dashboard镜像获取:docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0。 这里重新tag,并push到自己的私有镜像仓库了,命令如下所示: 然后将创建的Pod删除掉,修改deployment配置文件dashboard-deploy.yaml。 修改内容,如下所示:
删除创建的delpoyment、svc。 再次新建delpoyment、svc。 访问路径,查看界面。http://192.168.110.133:8080/ui/ k8s的dashboard是k8s的一个web界面的工具,可以创建多种资源或者删除资源。注意,如果三台机器挂起之后,第二次直接启动,你的dashboard好像不能访问耶,我直接重启了三台机器就行了,因为我的所有组件服务都是设置的开机自启动,避免了一些麻烦。
使用k8s的dashboard创建资源来创建一个资源,有两种方式,第一种是按照规则填写,第二种是上传Json格式的文件。
可以看到,默认是Deployment,这个很多东西估计和自己的dashboard的版本有关,所以根据自己的情况进行判断即可。 接下来,可以多这个Deployment进行删除或者编辑配置文件,这里将它删除掉。 然后,可以将创建的Service删除掉,如下所示:
这里Replica Sets也删除掉,deployment并不像RC直接去启动Pod,它们之间的区别是deployment会启动一个RS,RS拥有RC的百分之九十的功能,比RC的功能还多一些。 此时,可以看到创建的两个Pod也就删除掉了。 Kubernetes(k8s)中dashboard的部署。 标签:initial names git dem extension complete not ready 编辑 原文地址:https://www.cnblogs.com/biehongli/p/13159610.html 1 [root@k8s-master ~]# cd k8s/
2 [root@k8s-master k8s]# ls
3 book-master.war deploy health pod rc skydns skydns.zip svc tomcat_demo tomcat_demo.zip
4 [root@k8s-master k8s]# wget https://www.qstack.com.cn/dashboard.zip
5 --2020-06-18 20:02:26-- https://www.qstack.com.cn/dashboard.zip
6 Resolving www.qstack.com.cn (www.qstack.com.cn)... 123.125.46.149, 111.202.85.37
7 Connecting to www.qstack.com.cn (www.qstack.com.cn)|123.125.46.149|:443... connected.
8 HTTP request sent, awaiting response... 200 OK
9 Length: 1099 (1.1K) [application/zip]
10 Saving to: ‘dashboard.zip’
11
12 100%[=======================================================================================================================================================================>] 1,099 --.-K/s in 0.05s
13
14 2020-06-18 20:02:26 (20.2 KB/s) - ‘dashboard.zip’ saved [1099/1099]
15
16 [root@k8s-master k8s]# unzip dashboard.zip
17 Archive: dashboard.zip
18 creating: dashboard/
19 inflating: dashboard/dashboard-deploy.yaml
20 inflating: dashboard/dashboard-svc.yaml
21 [root@k8s-master k8s]#
1 [root@k8s-master dashboard]# vim dashboard-deploy.yaml
1 [root@k8s-master ~]# docker pull registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64:v1.10.0
2 Trying to pull repository registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64 ...
3 sha256:7755c0e7cb7e2585d21712f90e3d86d71cbc6362ab8fe283dae84cedc9c13396: Pulling from registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64
4 833563f653b3: Pull complete
5 Digest: sha256:7755c0e7cb7e2585d21712f90e3d86d71cbc6362ab8fe283dae84cedc9c13396
6 Status: Downloaded newer image for registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64:v1.10.0
7 [root@k8s-master ~]# docker images
8 REPOSITORY TAG IMAGE ID CREATED SIZE
9 192.168.110.133:5000/tomcat latest 2eb5a120304e 8 days ago 647 MB
10 docker.io/tomcat latest 2eb5a120304e 8 days ago 647 MB
11 192.168.110.133:5000/mysql 5.7.30 9cfcce23593a 9 days ago 448 MB
12 docker.io/mysql 5.7.30 9cfcce23593a 9 days ago 448 MB
13 docker.io/busybox latest 1c35c4412082 2 weeks ago 1.22 MB
14 docker.io/registry latest 708bc6af7e5e 4 months ago 25.8 MB
15 192.168.110.133:5000/nginx 1.15 53f3fd8007f7 13 months ago 109 MB
16 docker.io/nginx 1.15 53f3fd8007f7 13 months ago 109 MB
17 registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64 v1.10.0 9e12bc435ba6 15 months ago 122 MB
18 192.168.110.133:5000/nginx 1.13 ae513a47849c 2 years ago 109 MB
19 docker.io/nginx 1.13 ae513a47849c 2 years ago 109 MB
20 registry.access.redhat.com/rhel7/pod-infrastructure latest 99965fb98423 2 years ago 209 MB
21 192.168.110.133:5000/pod-infrastructure latest 34d3450d733b 3 years ago 205 MB
22 [root@k8s-master ~]# docker tag registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64:v1.10.0 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.10.0
23 [root@k8s-master ~]# docker push 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.10.0
24 The push refers to a repository [192.168.110.133:5000/kubernetes-dashboard-amd64]
25 5f222ffea122: Pushed
26 v1.10.0: digest: sha256:7755c0e7cb7e2585d21712f90e3d86d71cbc6362ab8fe283dae84cedc9c13396 size: 529
27 [root@k8s-master ~]#
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4 # Keep the name in sync with image version and
5 # gce/coreos/kube-manifests/addons/dashboard counterparts
6 name: kubernetes-dashboard-latest
7 namespace: kube-system
8 spec:
9 replicas: 1
10 template:
11 metadata:
12 labels:
13 k8s-app: kubernetes-dashboard
14 version: latest
15 kubernetes.io/cluster-service: "true"
16 spec:
17 containers:
18 - name: kubernetes-dashboard
19 image: 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.10.0
20 resources:
21 # keep request = limit to keep this container in guaranteed class
22 limits:
23 cpu: 100m
24 memory: 50Mi
25 requests:
26 cpu: 100m
27 memory: 50Mi
28 ports:
29 - containerPort: 9090
30 args:
31 - --apiserver-host=http://192.168.110.133:8080
32 livenessProbe:
33 httpGet:
34 path: /
35 port: 9090
36 initialDelaySeconds: 30
37 timeoutSeconds: 30
1 [root@k8s-master dashboard]# kubectl create -f dashboard-deploy.yaml
2 deployment "kubernetes-dashboard-latest" created
1 apiVersion: v1
2 kind: Service
3 metadata:
4 name: kubernetes-dashboard
5 namespace: kube-system
6 labels:
7 k8s-app: kubernetes-dashboard
8 kubernetes.io/cluster-service: "true"
9 spec:
10 selector:
11 k8s-app: kubernetes-dashboard
12 ports:
13 - port: 80
14 targetPort: 9090
1 [root@k8s-master dashboard]# kubectl create -f dashboard-svc.yaml
2 service "kubernetes-dashboard" created
3 [root@k8s-master dashboard]#
1 [root@k8s-master dashboard]# kubectl get all --namespace=kube-system
2 NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
3 deploy/kube-dns 1 1 1 1 4h
4 deploy/kubernetes-dashboard-latest 1 1 1 1 4m
5
6 NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
7 svc/kube-dns 10.254.230.254
1 the server could not find the requested resource
1 [root@k8s-master ~]# kubectl version
2 Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
3 Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"269f928217957e7126dc87e6adfa82242bfe5b1e", GitTreeState:"clean", BuildDate:"2017-07-03T15:31:10Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
4 [root@k8s-master ~]#
1 [root@k8s-master dashboard]# docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0
2 Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64 ...
3 sha256:3bccb9256e8b14ae895d40d829ea45992389af3c1767a21eefbd4b3bf723f325: Pulling from registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64
4 33a12e3650c8: Pull complete
5 Digest: sha256:3bccb9256e8b14ae895d40d829ea45992389af3c1767a21eefbd4b3bf723f325
6 Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0
7 [root@k8s-master dashboard]# docker images
8 REPOSITORY TAG IMAGE ID CREATED SIZE
9 192.168.110.133:5000/tomcat latest 2eb5a120304e 8 days ago 647 MB
10 docker.io/tomcat latest 2eb5a120304e 8 days ago 647 MB
11 192.168.110.133:5000/mysql 5.7.30 9cfcce23593a 9 days ago 448 MB
12 docker.io/mysql 5.7.30 9cfcce23593a 9 days ago 448 MB
13 docker.io/busybox latest 1c35c4412082 2 weeks ago 1.22 MB
14 docker.io/registry latest 708bc6af7e5e 4 months ago 25.8 MB
15 192.168.110.133:5000/nginx 1.15 53f3fd8007f7 13 months ago 109 MB
16 docker.io/nginx 1.15 53f3fd8007f7 13 months ago 109 MB
17 192.168.110.133:5000/kubernetes-dashboard-amd64 v1.10.0 9e12bc435ba6 15 months ago 122 MB
18 registry.cn-qingdao.aliyuncs.com/wangxiaoke/kubernetes-dashboard-amd64 v1.10.0 9e12bc435ba6 15 months ago 122 MB
19 docker.io/nginx 1.13 ae513a47849c 2 years ago 109 MB
20 192.168.110.133:5000/nginx 1.13 ae513a47849c 2 years ago 109 MB
21 registry.access.redhat.com/rhel7/pod-infrastructure latest 99965fb98423 2 years ago 209 MB
22 192.168.110.133:5000/pod-infrastructure latest 34d3450d733b 3 years ago 205 MB
23 registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64 v1.5.0 e5133bac8024 3 years ago 88.9 MB
24 [root@k8s-master dashboard]# docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.0 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.5.0
25 [root@k8s-master dashboard]# docker push 192.168.110.133:5000/kubernetes-dashboard-amd64:v1.5.0
26 The push refers to a repository [192.168.110.133:5000/kubernetes-dashboard-amd64]
27 0341ae9b0004: Pushed
28 v1.5.0: digest: sha256:ddd3454819c089517b434a3ea42abf3c184fce9bf45704abf22513082d900eba size: 529
29 [root@k8s-master dashboard]#
1 [root@k8s-master dashboard]# vim dashboard-deploy.yaml
1 [root@k8s-master dashboard]# vim dashboard-deploy.yaml
2 [root@k8s-master dashboard]# kubectl get svc
3 NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
4 kubernetes 10.254.0.1
1 [root@k8s-master dashboard]# kubectl get deployment --namespace=kube-system
2 NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
3 kube-dns 1 1 1 1 7h
4 kubernetes-dashboard-latest 1 1 1 1 2h
5 [root@k8s-master dashboard]# kubectl delete deployment --namespace=kube-system kubernetes-dashboard-latest
6 deployment "kubernetes-dashboard-latest" deleted
7 [root@k8s-master dashboard]# kubectl get all -o wide --namespace=kube-system
8 NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
9 deploy/kube-dns 1 1 1 1 7h
10
11 NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
12 svc/kube-dns 10.254.230.254
1 [root@k8s-master ~]# kubectl get pod -o wide --namespace=kube-system
2 NAME READY STATUS RESTARTS AGE IP NODE
3 kube-dns-778415672-q23st 4/4 Running 4 44m 172.16.92.4 k8s-master
4 kubernetes-dashboard-latest-3333846798-j8zjc 1/1 Running 1 3d 172.16.19.3 k8s-node2
5 nginx-2392975400-kmmth 1/1 Running 0 7m 172.16.93.3 k8s-node3
6 nginx-2392975400-xcfcc 1/1 Running 0 7m 172.16.19.4 k8s-node2
7 [root@k8s-master ~]# kubectl get pod -o wide --namespace=kube-system
8 NAME READY STATUS RESTARTS AGE IP NODE
9 kube-dns-778415672-q23st 4/4 Running 4 47m 172.16.92.4 k8s-master
10 kubernetes-dashboard-latest-3333846798-j8zjc 1/1 Running 1 3d 172.16.19.3 k8s-node2
11 [root@k8s-master ~]#
下一篇:ADO.NET调用存储过程
文章标题:Kubernetes(k8s)中dashboard的部署。
文章链接:http://soscw.com/index.php/essay/49525.html