Kubernetes集群配置dashboard服务

本文将在前文的基础上介绍kube-ui(也叫dashboard)的创建和使用。这个东西本质上就是webui连接master的api接口,通过api获取k8s集群的相关信息,然后在web上展示出来,对用户来说比较友好一些,实际用处并不是很大。

一、下载镜像文件并纳入本地仓库统一管理

# docker pull docker.io/mritd/kubernetes-dashboard-amd64
# docker tag docker.io/mritd/kubernetes-dashboard-amd64  registry.fjhb.cn/kubernetes-dashboard-amd64
# docker push registry.fjhb.cn/kubernetes-dashboard-amd64

二、根据rc文件创建 Deployment和service

# cat kube-ui-rc.yaml
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.  

# Configuration to deploy release version of the Dashboard UI.
#
# Example usage: kubectl create -f <this_file>  

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  labels:
    app: kubernetes-dashboard
    version: latest
  name: kubernetes-dashboard
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kubernetes-dashboard
  template:
    metadata:
      labels:
        app: kubernetes-dashboard
      # Comment the following annotation if Dashboard must not be deployed on master
      annotations:
        scheduler.alpha.kubernetes.io/tolerations: |
          [
            {
              "key": "dedicated",
              "operator": "Equal",
              "value": "master",
              "effect": "NoSchedule"
            }
          ]
    spec:
      containers:
      - name: kubernetes-dashboard
        image:  registry.fjhb.cn/kubernetes-dashboard-amd64
        imagePullPolicy: Always
        ports:
        - containerPort: 9090
          protocol: TCP
        args:
          # Uncomment the following line to manually specify Kubernetes API server Host
          # If not specified, Dashboard will attempt to auto discover the API server and connect
          # to it. Uncomment only if the default does not work.
          - --apiserver-host=192.168.115.5:8080
        livenessProbe:
          httpGet:
            path: /
            port: 9090
          initialDelaySeconds: 30
          timeoutSeconds: 30
---
kind: Service
apiVersion: v1
metadata:
  labels:
    app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: default
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 9090
  selector:
    app: kubernetes-dashboard
# kubectl create -f kube-ui-rc.yaml
# kubectl get svc
# kubectl get pod


三、web访问测试
使用两个node节点的ip加端口都可以访问到web-ui界面,本质上是使用iptables nat规则实现的




在面板中可以查看到
Node、deployments、replica sets、replication controllers、pod、jobs、services、ingress、storage、secret等信息,本质上就是通过连接apiserver进行查询并在web-ui上进行展示。

原文地址:http://blog.51cto.com/ylw6006/2067927

时间: 2024-08-30 10:00:09

Kubernetes集群配置dashboard服务的相关文章

Kubernetes集群部署DNS服务

Kubernetes集群部署DNS服务在kubernetes中每一个service都会被分配一个虚拟IP,每一个Service在正常情况下都会长时间不会改变,这个相对于pod的不定IP,对于集群中APP的使用相对是稳定的. 但是Service的信息注入到pod目前使用的是环境变量的方式,并且十分依赖于pod(rc)和service的创建顺序,这使得这个集群看起来又不那么完美,于是kubernetes以插件的方式引入了DNS系统,利用DNS对Service进行一个映射,这样我们在APP中直接使用域

基于kubernetes集群部署DashBoard

在之前一篇文章Centos7部署Kubernetes集群(http://www.cnblogs.com/zhenyuyaodidiao/p/6500830.html)中已经搭建了基本的K8s集群,本文将在此基础之上继续搭建K8s DashBoard. 1.yaml文件 编辑dashboard.yaml,注意或更改以下红色部分: apiVersion: extensions/v1beta1 kind: Deployment metadata: # Keep the name in sync wit

kubernetes集群部署DashBoard

搭建K8s DashBoard 集群结构: 类型 主机名 ip Master k8s_master 192.168.3.216 Node k8s_client1 192.168.3.217 Node k8s_client2 192.168.3.219 以下操作都在k8s_master上执行:一.镜像下载[[email protected]_master ~]# docker pull docker.io/siriuszg/kubernetes-dashboard-amd64:v1.5.1Tryi

Ubuntu集群 配置ntp服务

1.概述 NTP(Network Time Protocol)是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击.(来自 百度百科) 2.集群状况 现在又4台Ubuntu主机,选择其中一台作为提供ntp服务的主机(server01). 3.安装ntp服务 在提供ntp服务的主机上安装ntpserver: apt-get in

kubernetes集群traefik ingress实现同一命名空间不同微服务模块的访问

背景:kubernetes集群traefik ingress实现同一命名空间不同微服务模块的访问1.安装traefik ingresscat > traefik-ingress.yaml <<EOF kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata:name: traefik-ingress-controllerrules: apiGroups: ""resources: pods se

052.Kubernetes集群管理-故障排错指南

一 故障指南 1.1 常见问题排障 为了跟踪和发现在Kubernetes集群中运行的容器应用出现的问题,常用如下查错方法: 查看Kubernetes对象的当前运行时信息,特别是与对象关联的Event事件.这些事件记录了相关主题.发生时间.最近发生时间.发生次数及事件原因等,对排查故障非常有价值.此外,通过查看对象的运行时数据,还可以发现参数错误.关联错误.状态异常等明显问题.由于在Kubernetes中多种对象相互关联,因此这一步可能会涉及多个相关对象的排查问题. 对于服务.容器方面的问题,可能

使用kubeadm部署kubernetes集群

使用kubeadm部署kubernetes集群 通过docker,我们可以在单个主机上快速部署各个应用,但是实际的生产环境里,不会单单存在一台主机,这就需要用到docker集群管理工具了,本文将简单介绍使用docker集群管理工具kubernetes进行集群部署. 1 环境规划与准备 本次搭建使用了三台主机,其环境信息如下:| 节点功能 | 主机名 | IP || ------|:------:|-------:|| master | master |192.168.1.11 || slave1

Centos7部署Kubernetes集群+flannel

centos7 部署Kubernetes+flannel https://www.cnblogs.com/zhenyuyaodidiao/p/6500830.html kubernetes集群部署DashBoard http://www.cnblogs.com/zhenyuyaodidiao/p/6500897.html 原文地址:http://blog.51cto.com/lookingdream/2094162

Traefik实现Kubernetes集群服务外部https访问

1.部署 Traefik 由于我们需要将外部对于kubernetes的http请求全都转换成https,不想更改服务的配置以及代码,那我们可以选择在traefik上配置域名证书,这样通过域名对服务的访问将会自动转换成https请求. 1.1创建ClusterRole以及ClusterRoleBinding(Kubernetes1.6+) ingress-rbac.yaml文件: apiVersion: v1 kind: ServiceAccount metadata:   name: ingre