---
title: "returns detailed information about NetworkPolicy"
method: GET
path: "/api/v1/networkpolicy/{namespace}/{networkpolicy}"
---

# returns detailed information about NetworkPolicy

`GET /api/v1/networkpolicy/{namespace}/{networkpolicy}`

## Path parameters

- `namespace` string, required
- `networkpolicy` string, required

## Query parameters

- `filterBy` string
- `sortBy` string
- `itemsPerPage` string
- `page` string
- `metricNames` string
- `aggregations` string

## Response `200`

OK

- NetworkpolicyNetworkPolicyDetail
  - `egress` V1NetworkPolicyEgressRule[]
    - `ports` V1NetworkPolicyPort[] — ports is a list of destination ports for outgoing traffic. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
      - `endPort` integer — endPort indicates that the range of ports from port to endPort if set, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port.
      - `port` IntstrIntOrString
        - `IntVal` integer, required
        - `StrVal` string, required
        - `Type` integer, required
      - `protocol` string — protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP.
    - `to` V1NetworkPolicyPeer[] — to is a list of destinations for outgoing traffic of pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all destinations (traffic not restricted by destination). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the to list.
      - `ipBlock` V1IPBlock — IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.
        - `cidr` string, required — cidr is a string representing the IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64"
        - `except` string[] — except is a slice of CIDRs that should not be included within an IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64" Except values will be rejected if they are outside the cidr range
      - `namespaceSelector` V1LabelSelector — A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
        - `matchExpressions` V1LabelSelectorRequirement[] — matchExpressions is a list of label selector requirements. The requirements are ANDed.
          - `key` string, required — key is the label key that the selector applies to.
          - `operator` string, required — operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
          - `values` string[] — values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
        - `matchLabels` object — matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
      - `podSelector` V1LabelSelector — A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
        - `matchExpressions` V1LabelSelectorRequirement[] — matchExpressions is a list of label selector requirements. The requirements are ANDed.
          - `key` string, required — key is the label key that the selector applies to.
          - `operator` string, required — operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
          - `values` string[] — values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
        - `matchLabels` object — matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
  - `errors` Error[], required
    - unknown
  - `ingress` V1NetworkPolicyIngressRule[]
    - `from` V1NetworkPolicyPeer[] — from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
      - `ipBlock` V1IPBlock — IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.
        - `cidr` string, required — cidr is a string representing the IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64"
        - `except` string[] — except is a slice of CIDRs that should not be included within an IPBlock Valid examples are "192.168.1.0/24" or "2001:db8::/64" Except values will be rejected if they are outside the cidr range
      - `namespaceSelector` V1LabelSelector — A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
        - `matchExpressions` V1LabelSelectorRequirement[] — matchExpressions is a list of label selector requirements. The requirements are ANDed.
          - `key` string, required — key is the label key that the selector applies to.
          - `operator` string, required — operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
          - `values` string[] — values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
        - `matchLabels` object — matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
      - `podSelector` V1LabelSelector — A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
        - `matchExpressions` V1LabelSelectorRequirement[] — matchExpressions is a list of label selector requirements. The requirements are ANDed.
          - `key` string, required — key is the label key that the selector applies to.
          - `operator` string, required — operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
          - `values` string[] — values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
        - `matchLabels` object — matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
    - `ports` V1NetworkPolicyPort[] — ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
      - `endPort` integer — endPort indicates that the range of ports from port to endPort if set, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port.
      - `port` IntstrIntOrString
        - `IntVal` integer, required
        - `StrVal` string, required
        - `Type` integer, required
      - `protocol` string — protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP.
  - `objectMeta` TypesObjectMeta, required
    - `annotations` object
    - `creationTimestamp` V1Time
      - `Time` string, date-time, required
    - `labels` object
    - `name` string
    - `namespace` string
    - `uid` string
  - `podSelector` V1LabelSelector, required — A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.
    - `matchExpressions` V1LabelSelectorRequirement[] — matchExpressions is a list of label selector requirements. The requirements are ANDed.
      - `key` string, required — key is the label key that the selector applies to.
      - `operator` string, required — operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
      - `values` string[] — values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
    - `matchLabels` object — matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
  - `policyTypes` string[]
  - `typeMeta` TypesTypeMeta, required
    - `kind` string
    - `restartable` boolean
    - `scalable` boolean

---

[API](https://skmtc.net/karmada-io/apis/kubernetes-dashboard-api.md) · [All operations](https://skmtc.net/karmada-io/apis/kubernetes-dashboard-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/karmada-io/kubernetes-dashboard-api/versions/8521b53800a7/schema)
