OpenShift - List projects using the oc get netnamespaces command

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
project001  6509873  [""]
project002  1520201  [""]
project003  3967913  [""]


Egress provides a way for an application deployed on OpenShift to access an external URL, such as

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 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
project001  6509873  [""]


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
kind: NetNamespace
  creationTimestamp: "2021-07-22T13:21:13Z"
  generation: 2
  - apiVersion:
    fieldsType: FieldsV1
      f:netid: {}
      f:netname: {}
    manager: openshift-sdn-controller
    operation: Update
    time: "2021-07-22T13:21:13Z"
  - apiVersion:
    fieldsType: FieldsV1
      f:egressIPs: {}
    manager: kubectl-patch
    operation: Update
    time: "2021-07-22T13:39:29Z"
  name: project001
  resourceVersion: "4030889"
  selfLink: /apis/
  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

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |