Bootstrap FreeKB - OpenShift - List projects using the oc get netnamespaces command
OpenShift - List projects using the oc get netnamespaces command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get netnamespaces command can be used to return each project / namespace, the ID of each namespace, and the egress IP addresses associated with the namespace.

~]# oc get netnamespaces
NAME        NETID     EGRESS IPS
project001  6509873  ["10.6.11.14"]
project002  1520201  ["10.56.1.231"]
project003  3967913  ["10.9.18.2"]

 

Egress provides a way for an application deployed on OpenShift to access an external URL, such as http://www.example.com.

NetNamespace is used to assign an egress IP address to one or more namespaces, so that all egress traffic from the namespace is using a dedicated IP address. By assigning a specific egress IP address to a namespace, all outbound (egress) requests from applications in the project will come from the dedicated egress IP address, making it easier to find the requests that came from applications in the project. This also makes it possible to have two (or more) different projects share the same egress IP address, as a way to group similar projects together.

 

An OpenShift route or an Ingress route will provide a URL such as http://route001-project001.apps.openshift.example.com:8080 which is used to route a request onto a service, which is then routed onto a pod, and then to the container in the pod, and finally to the application running in the container.

 

Or a specific netnamespace can be returned.

~]# oc get netnamespace project001
NAME        NETID     EGRESS IPS
project001  6509873  ["10.6.11.14"]

 

The --output json or --output yaml option can be used to return additional output in JSON or YAML format.

~]# oc get netnamespace project001 --output yaml
apiVersion: network.openshift.io/v1
egressIPs:
- 10.6.11.14
kind: NetNamespace
metadata:
  creationTimestamp: "2021-07-22T13:21:13Z"
  generation: 2
  managedFields:
  - apiVersion: network.openshift.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:netid: {}
      f:netname: {}
    manager: openshift-sdn-controller
    operation: Update
    time: "2021-07-22T13:21:13Z"
  - apiVersion: network.openshift.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:egressIPs: {}
    manager: kubectl-patch
    operation: Update
    time: "2021-07-22T13:39:29Z"
  name: project001
  resourceVersion: "4030889"
  selfLink: /apis/network.openshift.io/v1/netnamespaces/project001
  uid: 2756a33b-77d6-489f-a6fa-10f66bd5d707
netid: 5512933
netname: project001

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 3b6a4b in the box below so that we can be sure you are a human.