k8s部署dashborad

環境:docker

兩臺虛擬機,api

10.10.20.203 部署docker、etcd、flannel、kube-apiserver、kube-controller-manager、kube-schedulerapp

10.10.20.206 部署docker、flannel、kubelet、kube-proxyui

 

一、下載dashborad的鏡像,並上傳到私服,下載方式以下this

docker pull index.tenxcloud.com/google_containers/kubernetes-dashboard-amd64

二、建立命名空間namespace.yamlgoogle

apiVersion: v1
kind: Namespace
metadata:
  name: kube-system

三、建立rc.yamlspa

apiVersion: v1
kind: ReplicationController
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
  labels:
    k8s-app: kubernetes-dashboard
    version: latest
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    k8s-app: kubernetes-dashboard
  template:
    metadata:
      labels:
        k8s-app: kubernetes-dashboard
        version: latest
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: kubernetes-dashboard
        image: 10.10.20.202/library/kube-dashborad
        resources:
          # keep request = limit to keep this container in guaranteed class
          limits:
            cpu: 100m
            memory: 50Mi
          requests:
            cpu: 100m
            memory: 50Mi
        ports:
        - containerPort: 8080
        args:
        -  --apiserver-host=http://10.10.20.203:8080

四、建立service.yamlcode

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

五、建立命名空間、rc和serviceorm

kubectl create -f namespace.yaml
kubectl create -f rc.yaml
kubectl create -f service.yaml

六、查看命名空間server

[root@k8s-master ui]# kubectl get namespace
NAME          STATUS    AGE
default       Active    19h
kube-system   Active    19h

七、查看pod

[root@k8s-master ui]# kubectl get pods --namespace=kube-system
NAME                         READY     STATUS    RESTARTS   AGE
kubernetes-dashboard-5q44n   1/1       Running   0          14s
[root@k8s-master ui]# kubectl describe pods kubernetes-dashboard-5q44n --namespace=kube-system
Name:        kubernetes-dashboard-5q44n
Namespace:    kube-system
Node:        k8s-slave1-206/60.19.29.21
Start Time:    Fri, 12 Aug 2016 00:01:34 -0700
Labels:        k8s-app=kubernetes-dashboard
        kubernetes.io/cluster-service=true
        version=latest
Status:        Running
IP:        10.0.83.4
Controllers:    ReplicationController/kubernetes-dashboard
Containers:
  kubernetes-dashboard:
    Container ID:    docker://8bd1e628e93fbb416df82660fca4083b2e22a879f5a9714cb990e32fde3a4a29
    Image:        10.10.20.202/library/kube-dashborad
    Image ID:        docker://sha256:30535a9c0fa0842f5e9d882cbbfa0c62d3e2cd63cbe00c9c7b81988b42ae7921
    Port:        8080/TCP
    Args:
      --apiserver-host=http://10.10.20.203:8080
    Limits:
      cpu:    100m
      memory:    50Mi
    Requests:
      cpu:            100m
      memory:            50Mi
    State:            Running
      Started:            Fri, 12 Aug 2016 00:01:35 -0700
    Ready:            True
    Restart Count:        0
    Liveness:            http-get http://:8080/ delay=30s timeout=5s period=10s #success=1 #failure=3
    Environment Variables:    <none>
Conditions:
  Type        Status
  Initialized     True
  Ready     True
  PodScheduled     True
No volumes.
QoS Tier:    Guaranteed
Events:
  FirstSeen    LastSeen    Count    From                SubobjectPath                Type        Reason                  Message
  ---------    --------    -----    ----                -------------                --------    ------                  -------
  39s        39s        1    {default-scheduler }                            Normal        Scheduled              Successfully assigned kubernetes-dashboard-5q44n to k8s-slave1-206
  39s        39s        1    {kubelet k8s-slave1-206}    spec.containers{kubernetes-dashboard}    Normal        Pulling                  pulling image "10.10.20.202/library/kube-dashborad"
  39s        38s        2    {kubelet k8s-slave1-206}                        Warning        MissingClusterDNS    kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
  38s        38s        1    {kubelet k8s-slave1-206}    spec.containers{kubernetes-dashboard}    Normal        Pulled                  Successfully pulled image "10.10.20.202/library/kube-dashborad"
  38s        38s        1    {kubelet k8s-slave1-206}    spec.containers{kubernetes-dashboard}    Normal        Created                  Created container with docker id 8bd1e628e93f
  38s        38s        1    {kubelet k8s-slave1-206}    spec.containers{kubernetes-dashboard}    Normal        Started                  Started container with docker id 8bd1e628e93f

八、查看service

[root@k8s-master ui]# kubectl get service --namespace=kube-system
NAME                   CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
kubernetes-dashboard   10.254.160.209   <none>        80/TCP    20s
[root@k8s-master ui]# kubectl describe service kubernetes-dashboard --namespace=kube-system
Name:            kubernetes-dashboard
Namespace:        kube-system
Labels:            k8s-app=kubernetes-dashboard
            kubernetes.io/cluster-service=true
Selector:        k8s-app=kubernetes-dashboard
Type:            ClusterIP
IP:            10.254.160.209
Port:            <unset>    80/TCP
Endpoints:        10.0.83.4:9090
Session Affinity:    None
No events.

九、訪問dashborad,http://10.10.20.203:8080/ui

相關文章
相關標籤/搜索