k8s部署dashborad

环境:

两台虚拟机,

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

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

 

1、下载dashborad的镜像,并上传到私服,下载方式如下

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

2、创建命名空间namespace.yaml

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

3、创建rc.yaml

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

4、创建service.yaml

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

5、创建命名空间、rc和service

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

6、查看命名空间

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

7、查看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

8、查看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.

9、访问dashborad,http://10.10.20.203:8080/ui

 

posted @ 2016-08-12 15:06  puroc  阅读(1945)  评论(0编辑  收藏  举报