Author topic on namespace context (#339)

This commit is contained in:
Jim Galasyn 2017-12-11 08:22:03 -08:00
parent 2cf28eb9cb
commit 08be0735d5
6 changed files with 115 additions and 1 deletions

View File

@ -1579,6 +1579,8 @@ manuals:
title: Manage and deploy private images title: Manage and deploy private images
- path: /datacenter/ucp/3.0/guides/admin/configure/set-orchestrator-type/ - path: /datacenter/ucp/3.0/guides/admin/configure/set-orchestrator-type/
title: Set the orchestrator type for a node title: Set the orchestrator type for a node
- path: /datacenter/ucp/3.0/guides/admin/configure/view-namespace-resources/
title: View Kubernetes objects in a namespace
- sectiontitle: Join nodes to your cluster - sectiontitle: Join nodes to your cluster
section: section:
- path: /datacenter/ucp/3.0/guides/admin/configure/join-nodes/ - path: /datacenter/ucp/3.0/guides/admin/configure/join-nodes/

View File

@ -0,0 +1,112 @@
---
title: View Kubernetes objects in a namespace
description: Learn how to set the Kubernetes namespace context in a Docker Enterprise Edition cluster.
keywords: Docker EE, UCP, Kubernetes, namespace
---
With Docker Enterprise Edition, administrators can filter the view of
Kubernetes objects by the namespace the objects are assigned to. You can
specify a single namespace, or you can specify all available namespaces.
## Create two namespaces
In this example, you create two Kubernetes namespaces and deploy a service
to both of them.
1. Log in to the UCP web UI with an administrator account.
2. In the left pane, click **Kubernetes**.
3. Click **Create** to open the **Create Kubernetes Object** page.
4. In the **Object YAML** editor, paste the following YAML.
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: blue
---
apiVersion: v1
kind: Namespace
metadata:
name: orange
```
5. Click **Create** to create the `blue` and `orange` namespaces.
![](../../images/view-namespace-resources-1.png){: .with-border}
## Deploy services
Create a `NodePort` service in the `blue` namespace.
1. Navigate to the **Create Kubernetes Object** page.
2. In the **Namespace** dropdown, select **blue**.
3. In the **Object YAML** editor, paste the following YAML.
```yaml
apiVersion: v1
kind: Service
metadata:
name: app-service-blue
labels:
app: app-blue
spec:
type: NodePort
ports:
- port: 80
nodePort: 30080
selector:
app: app-blue
```
4. Click **Create** to deploy the service in the `blue` namespace.
Repeat the previous steps with the following YAML, but this time, select
`orange` from the **Namespace** dropdown.
```yaml
apiVersion: v1
kind: Service
metadata:
name: app-service-orange
labels:
app: app-orange
spec:
type: NodePort
ports:
- port: 80
nodePort: 30081
selector:
app: app-orange
```
## View services
Currently, the **Namespaces** view is set to the **default** namespace, so the
**Load Balancers** page doesn't show your services.
1. In the left pane, click **Namespaces** to open the list of namespaces.
2. In the upper-right corner, click the **Set context for all namespaces**
toggle. The indicator in the left pane changes to **All Namespaces**.
3. Click **Load Balancers** to view your services.
![](../../images/view-namespace-resources-2.png){: .with-border}
## Filter the view by namespace
With the **Set context for all namespaces** toggle set, you see all of the
Kubernetes objects in every namespace. Now filter the view to show only
objects in one namespace.
1. In the left pane, click **Namespaces** to open the list of namespaces.
2. In the **orange** namespace, click the **More options** icon and in the
context menu, select **Set Context**.
![](../../images/view-namespace-resources-3.png){: .with-border}
3. Click **Confirm** to set the context to the `orange` namespace.
The indicator in the left pane changes to **orange**.
4. Click **Load Balancers** to view your `app-service-orange` service.
The `app-service-blue` service doesn't appear.
To view the `app-service-blue` service, repeat the previous steps, but this
time, select **Set Context** on the **blue** namespace.

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -65,7 +65,7 @@ links in the **Kubernetes** section of the left pane.
## Expose the server ## Expose the server
The NGINX server is up and running, but it's not accessble from outside of the The NGINX server is up and running, but it's not accessible from outside of the
cluster. Add a `NodePort` service to expose the server on a specified port: cluster. Add a `NodePort` service to expose the server on a specified port:
```yaml ```yaml