<p>I'm writing the network policies of a Kubernetes cluster. How can I specify a single IP address that I want to authorize in my egress policy instead of authorizing a whole range of IP addresses ?</p>

<p>An example based on the <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/#the-networkpolicy-resource" rel="nofollow noreferrer">official docs</a>:</p>

<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      role: db
  policyTypes:
  - Egress
  egress:
  - to:
    - ipBlock:
        cidr: 10.11.12.13/32
    ports:
    - protocol: TCP
      port: 5978
</code></pre>

<p>It's essential to use <code>/32</code> subnet prefix length which indicates that you're limiting the scope of the rule just to this one IP address.</p>
