安装k8s doashboard

1. 到github下载想要安装的版本.yaml文件。比如我想安装v1.10.1版本的,到github上kubernetes/dashboard的release v1.10.1处有

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

我们先把.yaml文件下载下来:

wget  https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

因为里面使用了境外的镜像,我们修改里面的配置,使用我们能够拉取的镜像:

1.已知 lizhenliang/kubernetes-dashboard-amd64:v1.10.1 镜像可以拉取,

vim kubernetes-dashboard.yaml

containers:
      - name: kubernetes-dashboard
        #image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
        image: lizhenliang/kubernetes-dashboard-amd64:v1.10.1

同时让dashboard可以外部访问,不仅仅是node内部能访问

# ------------------- Dashboard Service ------------------- #

kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:

#新加type
  type: NodePort
  ports:
    - port: 443
      targetPort: 8443
      nodePort: 30001 #添加nodePort
  selector:
    k8s-app: kubernetes-dashboard
 

参考:

https://www.cnblogs.com/imstrive/p/11480424.html

如果我们想要其它的镜像,可以在docker hub上寻找

 

二、我们可以先把镜像拉取下来,然后修改镜像名字,这样就不用修改kubernetes-dashboard.yaml文件里面的image了

拉取镜像:

docker pull mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0

列出镜像:
docker images|grep kubernetes-dashboard

修改镜像标签:
docker tag mirrorgooglecontainers/kubernetes-dashboard-amd64:v1.10.0 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0

 

最后部署镜像:

kubectl create -f kubernetes-dashboard.yaml

kubectl get pods -n kube-system

可以创建一个用户,用来登录dashboard

https://www.cnblogs.com/kuku0223/p/10338121.html

 

多种解决方法:

https://blog.csdn.net/networken/article/details/85607593

 

安装doashboard之后,创建用户使用token登录进去可能会出现 the service can not find the resource,然后返回登录页面。查看log:

 kubectl get pods -n kube-system -o wide

kubectl logs kubernetes-dashboard-68798cb565-c2bzh -n kube-system

出现Metric client health check failed: the server could not find the requested resource (get services heapster). Retrying in 30 seconds.字样,这是因为没有安装Metric导致,Metric用来收集cpu情况的。需要安装

docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3 k8s.gcr.io/metrics-server-amd64:v0.3.3
yum install -y git
git clone https://github.com/kubernetes-incubator/metrics-server.git
cd metrics-server/deploy/1.8+
#禁用自动拉取镜像,不然无法启动
sed -i s/Always/IfNotPresent/g metrics-server-deployment.yaml

imagePullPolicy下面添加一行如下内容。因为默认会使用主机名作为地址,也就是上一篇的node0。DNS是无法解析的,然后就是启用http方式,简化操作

        command: ["/metrics-server","--kubelet-preferred-address-types=InternalIP","--kubelet-insecure-tls"]
部署:

cd ..

kubectl apply -f kubernetes/

kubectl get apiservices | grep metrics

 

你可能感兴趣的:(Golang,容器)