首先 抓 kubernetes-dashboard.yaml
wget https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
修改加入 apiserver-host
- --apiserver-host=http://192.168.0.65:8080
請參考 : https://github.com/chio-nzgft/docker/blob/master/kubernetes-dashboard.yaml
建立 kubernetes-dashboard 及觀看 服務的 port (看 NodePort: <unset> 31942/TCP )
[root@master kubernetes]# kubectl create -f kubernetes-dashboard.yaml [root@master kubernetes]# kubectl get po --namespace=kube-system NAME READY STATUS RESTARTS AGE kubernetes-dashboard-1415224063-npuv4 1/1 Running 0 2m [root@master kubernetes]# kubectl logs kubernetes-dashboard-1415224063-npuv4 --namespace=kube-system Using HTTP port: 9090 Using apiserver-host location: http://192.168.0.65:8080 Creating API server client for http://192.168.0.65:8080 Successful initial request to the apiserver, version: v1.3.0 Creating in-cluster Heapster client Using random key for csrf signing [root@master kubernetes]# kubectl get service --namespace=kube-system NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard 10.254.226.211 <nodes> 80/TCP 6m [root@master ~]# kubectl describe service kubernetes-dashboard --namespace=kube-system Name: kubernetes-dashboard Namespace: kube-system Labels: app=kubernetes-dashboard Selector: app=kubernetes-dashboard Type: NodePort IP: 10.254.166.121 Port: <unset> 80/TCP NodePort: <unset> 31942/TCP Endpoints: 172.17.102.2:9090 Session Affinity: None No events.
打開 http://192.168.0.65:31946/ (就是打開 master 的 31942 port)
來熟習基本指令
kubectl get deployments --all-namespaces
kubectl get pods --all-namespaces
kubectl get svc --all-namespaces
kubectl get rs --all-namespaces
kubectl get rc --all-namespaces
kubectl delete svc <svc name > --namespace=
kubectl get events
kubectl describe ........
kubectl logs <pod name > --namespace=
例如 :
[root@master kubernetes]# kubectl get po --namespace=kube-system
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-1415224063-npuv4 1/1 Running 0 2m
[root@master kubernetes]# kubectl logs kubernetes-dashboard-1415224063-npuv4 --namespace=kube-system
Using HTTP port: 9090
Using apiserver-host location: http://192.168.0.65:8080
Creating API server client for http://192.168.0.65:8080
Successful initial request to the apiserver, version: v1.3.0
Creating in-cluster Heapster client
Using random key for csrf signing
[root@master kubernetes]# kubectl describe service kubernetes-dashboard --namespace=kube-system
Name: kubernetes-dashboard
Namespace: kube-system
Labels: app=kubernetes-dashboard
Selector: app=kubernetes-dashboard
Type: NodePort
IP: 10.254.192.215
Port: <unset> 80/TCP
NodePort: <unset> 31538/TCP
Endpoints: 172.17.0.2:9090
Session Affinity: None
No events.
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-1415224063-xibmc 1/1 Running 0 1h
[root@master kubernetes]# kubectl describe pod kubernetes-dashboard-1415224063-xibmc --namespace=kube-system
Name: kubernetes-dashboard-1415224063-xibmc
Namespace: kube-system
Node: 192.168.0.68/192.168.0.68
Start Time: Tue, 24 Jan 2017 12:25:38 +0800
Labels: app=kubernetes-dashboard
pod-template-hash=1415224063
Status: Running
IP: 172.17.0.2
Controllers: ReplicaSet/kubernetes-dashboard-1415224063
Containers:
kubernetes-dashboard:
Container ID: docker://ee2b50c642107159b2a6e5214b63145bc0eb5897dfde65588e079d015f49be65
Image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1
Image ID: docker-pullable://gcr.io/google_containers/kubernetes-dashboard-amd64@sha256:46a09eb9c611e625e7de3fcf325cf78e629d002e57dc80348e9b0638338206b5
Port: 9090/TCP
Args:
--apiserver-host=http://192.168.0.65:8080
State: Running
Started: Tue, 24 Jan 2017 12:25:40 +0800
Ready: True
Restart Count: 0
Liveness: http-get http://:9090/ delay=30s timeout=30s period=10s #success=1 #failure=3
Volume Mounts: <none>
Environment Variables: <none>
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
No volumes.
QoS Tier: BestEffort
No events.
留言列表