zoukankan      html  css  js  c++  java
  • Kubernetes的UI界面Kubernetes Dashboard的搭建

    1、搭建准备

    Kubernetes集群的安装部署

    2、搭建过程

    2.1、在master节点上创建kubernetes-dashboard.yaml

    cd /etc/kubernetes
    vim kubernetes-dashboard.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: v1.1.1
      name: kubernetes-dashboard
      namespace: kube-system
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: kubernetes-dashboard
      template:
        metadata:
          labels:
            app: kubernetes-dashboard
        spec:
          containers:
          - name: kubernetes-dashboard
            image: daocloud.io/minunix/kubernetes-dashboard-amd64:v1.1.1
            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=http://192.168.44.60:8080
            livenessProbe:
              httpGet:
                path: /
                port: 9090
              initialDelaySeconds: 30
              timeoutSeconds: 30
    ---
    kind: Service
    apiVersion: v1
    metadata:
      labels:
        app: kubernetes-dashboard
      name: kubernetes-dashboard
      namespace: kube-system
    spec:
      type: NodePort
      ports:
      - port: 80
        targetPort: 9090
      selector:
        app: kubernetes-dashboard

    2.2、下载pod-infrastructure镜像(每个节点上都需要)

    上篇文章中/etc/kubernetes/kubelet文件配置中,有一项配置需要docker的registry.access.redhat.com/rhel7/pod-infrastructure:latest镜像,所以我们先pull下来

    先yum安装rhsm

    yum install *rhsm* -y

    然后下载镜像

    docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest

    如果执行上一步报错,就执行以下两步,生成/etc/rhsm/ca/redhat-uep.pem这个文件,然后再执行上一步

    wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm
    rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv --to-stdout ./etc/rhsm/ca/redhat-uep.pem | tee /etc/rhsm/ca/redhat-uep.pem

    2.3、创建Kubernetes Dashboard

    在master节点上执行

    [root@k8s-master kubernetes]# kubectl create -f kubernetes-dashboard.yaml

    执行以下命令,查看是否成功

    [root@k8s-master kubernetes]# kubectl get pods --all-namespaces
    NAMESPACE     NAME                                   READY     STATUS    RESTARTS   AGE
    kube-system   kubernetes-dashboard-878342739-f8nhb   1/1       Running   0          1h

    如果上面的status为running,则成功,如果不是的话就需要查看详细信息,看是哪里出错

    [root@k8s-master kubernetes]# kubectl describe pods kubernetes-dashboard-878342739-f8nhb  --namespace="kube-system"

    2.4、访问UI界面

    http://k8s-master:8080/ui

    可能会出现以下错误,页面上报错

    Error: 'dial tcp 172.17.78.2:9090: getsockopt: connection timed out'
    Trying to reach: 'http://172.17.78.2:9090/'

    如果出现以上错误,执行以下命令(每台机器都执行一遍)

    iptables -P INPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -F
    iptables -L -n

    然后再访问UI界面

    ojbk。

  • 相关阅读:
    VC++基于ICMP 遍历路由表
    在XP上同时运行IE6,IE7,IE8,IE9
    VC++实现ARP协议
    在Windows Sever 2008 Windows7上同时运行绿色IE10测试HTML5
    VC++实践IOCP编程
    VC++实现检测网络状态所有的TCP与UDP通信
    VC++实现UDP数据包发送
    VC++实现改变网关
    面试十大难题的样板回答
    WinAPI: GetLocalTime、SetLocalTime、SetSystemTime 获取与设置系统时间
  • 原文地址:https://www.cnblogs.com/blazeZzz/p/10278415.html
Copyright © 2011-2022 走看看