- Home
- Operations Guide
- Administer an MKE cluster
- View Kubernetes objects in a namespace
View Kubernetes objects in a namespace#
MKE administrators can filter the view of Kubernetes objects by the namespace that the objects are assigned to, specifying a single namespace or all available namespaces. This topic describes how to deploy services to two newly created namespaces and then view those services, filtered by namespace.
To create two namespaces:
-
Log in to the MKE web UI as an administrator.
-
From the left-side navigation panel, click Kubernetes.
-
Click Create to open the Create Kubernetes Object page.
-
Leave the Namespace drop-down blank.
-
In the Object YAML editor, paste the following YAML code:
apiVersion: v1 kind: Namespace metadata: name: blue --- apiVersion: v1 kind: Namespace metadata: name: green -
Click Create to create the
blueandgreennamespaces.
To deploy services:
-
Create a
NodePortservice in thebluenamespace:-
From the left-side navigation panel, navigate to Kubernetes > Create.
-
In the Namespace drop-down, select blue.
-
In the Object YAML editor, paste the following YAML code:
apiVersion: v1 kind: Service metadata: name: app-service-blue labels: app: app-blue spec: type: NodePort ports: - port: 80 nodePort: 32768 selector: app: app-blue -
Click Create to deploy the service in the
bluenamespace.
-
-
Create a
NodePortservice in thegreennamespace:-
From the left-side navigation panel, navigate to Kubernetes > Create.
-
In the Namespace drop-down, select green.
-
In the Object YAML editor, paste the following YAML code:
apiVersion: v1 kind: Service metadata: name: app-service-green labels: app: app-green spec: type: NodePort ports: - port: 80 nodePort: 32769 selector: app: app-green -
Click Create to deploy the service in the
greennamespace.
-
To view the newly created services:
-
In the left-side navigation panel, click Namespaces.
-
In the upper-right corner, click the Set context for all namespaces toggle. The indicator in the left-side navigation panel under Namespaces changes to All Namespaces.
-
Click Services to view your services.
Filter the view by namespace:
-
In the left-side navigation panel, click Namespaces.
-
Hover over the blue namespace and click Set Context. The indicator in the left-side navigation panel under Namespaces changes to blue.
-
Click Services to view the app-service-blue service. Note that the app-service-green service does not display.
Perform the forgoing steps on the green namespace to view only the services deployed in the green namespace.