Google的 GCE环境中,使用k8s是非常方便,可以申请免费60天的试用。具体见:http://kubernetes.io/docs/hellonode/ 的相关教程
按照上述教程按照完成后,由于k8s 1.3的版本中kubectl config view 不再显示username和passoword,因此如果想获取访问dashboard页面的授权用户名和密码,必须通过gce的相关命令获取。
gcloud alpha container clusters describe hello-world --zone us-central1-a
clusterIpv4Cidr: 10.40.0.0/14
createTime: '2016-09-24T09:27:16+00:00'
currentMasterVersion: 1.3.7
currentNodeCount: 3
currentNodeVersion: 1.3.7
endpoint: 104.198.41.xxx
initialClusterVersion: 1.3.7
instanceGroupUrls:
- https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/instanceGroupManagers/gke-hello-world-default-pool-4626cef2-grp
locations:
- us-central1-a
loggingService: logging.googleapis.com
masterAuth:
clientCertificate: xxxxxxxxxxxxxxxx
clientKey: yyyyyyyyyyyyyyyy
clusterCaCertificate: zzzzzzzzz
password: P14BCs3MFFq7eYXc
username: admin
monitoringService: monitoring.googleapis.com
name: hello-world
network: default
nodeConfig:
diskSizeGb: 100
imageType: CONTAINER_VM
machineType: n1-standard-1
oauthScopes:
- https://www.googleapis.com/auth/compute
- https://www.googleapis.com/auth/devstorage.read_only
- https://www.googleapis.com/auth/service.management.readonly
- https://www.googleapis.com/auth/servicecontrol
- https://www.googleapis.com/auth/logging.write
- https://www.googleapis.com/auth/monitoring
serviceAccount: default
nodeIpv4CidrSize: 24
nodePools:
- config:
diskSizeGb: 100
imageType: CONTAINER_VM
machineType: n1-standard-1
oauthScopes:
- https://www.googleapis.com/auth/compute
- https://www.googleapis.com/auth/devstorage.read_only
- https://www.googleapis.com/auth/service.management.readonly
- https://www.googleapis.com/auth/servicecontrol
- https://www.googleapis.com/auth/logging.write
- https://www.googleapis.com/auth/monitoring
serviceAccount: default
initialNodeCount: 3
instanceGroupUrls:
- https://www.googleapis.com/compute/v1/projects/k8s-cluster-144402/zones/us-central1-a/instanceGroupManagers/gke-hello-world-default-pool-4626cef2-grp
name: default-pool
selfLink: https://container.googleapis.com/v1/projects/k8s-cluster-144402/zones/us-central1-a/clusters/hello-world/nodePools/default-pool
status: RUNNING
version: 1.3.7
selfLink: https://container.googleapis.com/v1/projects/k8s-cluster-144402/zones/us-central1-a/clusters/hello-world
servicesIpv4Cidr: 10.43.240.0/20
status: RUNNING
zone: us-central1-a