入门指南

如何开始使用 Kubernetes,并创建任务

编辑这个页面

Web UI (控制面板)

Dashboard (the web-based user interface of Kubernetes) allows you to deploy containerized applications to a Kubernetes cluster, troubleshoot them, and manage the cluster and its resources itself. You can use it for getting an overview of applications running on the cluster, as well as for creating or modifying individual Kubernetes resources and workloads, such as Daemon sets, Pet sets, Replica sets, Jobs, Replication controllers and corresponding Services, or Pods.

Dashboard also provides information on the state of Pods, Replication controllers, etc. and on any errors that might have occurred. You can inspect and manage the Kubernetes resources, as well as your deployed containerized applications. You can also change the number of replicated Pods, delete Pods, and deploy new applications using a deploy wizard.

By default, Dashboard is installed as a cluster addon. It is enabled by default as of Kubernetes 1.2 clusters.

访问控制面板

在浏览器中输入以下网址:

https://<kubernetes-master>/ui

它会重定向到以下网址:

https://<kubernetes-master>/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

控制面板在kube-system namespace之下,但是它会显示你的环境下的所有 namespaces 的资源。

如果不能访问控制面板,你可以运行一下命令来安装最新稳定版:

kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml

然后打开

https://<kubernetes-master>/ui

如果需要密码的话,可以使用下面的命令来找到它:

kubectl config view

欢迎页面

当第一次访问一个空的群集上的控制面板,它会显示欢迎页面。此页面包含这个文档的链接,以及一个首次部署应用的按钮。此外,还可以查看在kube-system namespace默认 运行的应用。 例如类似 Heapster 的监控应用。

Kubernetes Dashboard welcome page

部署容器化应用

Dashboard(控制面板)可以让你创建和部署容器化应用作为一个 Replication Controller 和 相应 Service的简单向导。你可以手动指定应用程序的设置,或者上传一个包含所需信息的 YAML 或者 JSON 文件

要访问欢迎页面上的部署向导,点击相应的按钮。以后在任何页面点击右上角的 DEPLOY APP 或者 UPLOAD YAML 链接,来访问该向导。

Deploy wizard

指定应用的详细配置

部署向导需要你提供一下信息:

If needed, you can expand the Advanced options section where you can specify more settings:

Deploy wizard advanced options

Uploading a YAML or JSON file

Kubernetes supports declarative configuration. In this style, all configuration is stored in YAML or JSON configuration files using the Kubernetes’ API resource schemas as the configuration schemas.

As an alternative to specifying application details in the deploy wizard, you can define your Replication Controllers and Services in YAML or JSON files, and upload the files to your Pods:

Deploy wizard file upload

Managing resources

List view

As soon as applications are running on your cluster, Dashboard’s initial view defaults to showing all resources available in all namespaces in a list view, for example:

Workloads view

For every resource, the list view shows the following information:

To filter the resources and only show those of a specific namespace, select it from the dropdown list in the right corner of the title bar:

Namespace selector

Details view

When clicking a resource, the details view is opened, for example:

Details view

The OVERVIEW tab shows the actual resource details as well as the Pods the resource is running in.

The EVENTS tab can be useful for debugging applications.

To go back to the workloads overview, click the Kubernetes logo.

Workload categories

Workloads are categorized as follows:

You can display the resources of a specific category in two ways:

Actions

Every list view offers an action menu to the right of the listed resources. The related details view provides the same actions as buttons in the upper right corner of the page.

More information

For more information, see the Kubernetes Dashboard repository.

Analytics