linkerd / linkerd/linkerd2

Improve documentation on Linkerd 2.x for Kubernetes NetworkPolicy

Open
#8,765 3 comments 3 reactions 1 assignee View on GitHub

@kflynn is already working on this.

Since Sep 25, 2025.

area/docs enhancement help wanted
Dominant language
Go
Stars
11.5k
Forks
1.4k
Avg merge
3d 22h
Merged PRs (30d)
53

Description

### What problem are you trying to solve?

In hardening a Kubernetes cluster, using a NetworkPolicy to restrict ingress between namespaces is useful.

I only found documentation here: https://ihcsim.medium.com/linkerd-2-x-with-network-policy-2657103333ca

Which pointed me in the direction to get this functionality working.

Specifically (though this could be tightened to port 443 as mentioned in the webpage above).

```
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-meshed-ingress
namespace: linkerd
spec:
ingress:
- from:
- ipBlock:
cidr: X.X.X.X/20
podSelector: {}
policyTypes:
- Ingress
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-meshed-ingress
namespace: linkerd-viz
spec:
ingress:
- from:
- ipBlock:
cidr: X.X.X.X/20
podSelector: {}
policyTypes:
- Ingress
```

And, in the case of the namespace we want permission for linkerd to to access:

```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-linkerd-ingress
namespace: emojivoto
spec:
ingress:
- from:
- namespaceSelector:
matchLabels:
linkerd.io/control-plane-ns: linkerd
podSelector:
matchLabels:
linkerd.io/control-plane-ns: linkerd
podSelector: {}
policyTypes:
- Ingress
```

Since a default restricted namespace allows no ingress between namespaces.

### How should the problem be solved?

Some documentation to help improve security with linkerd. It is of course, optional if you want to use a NetworkPolicy to restrict traffic.

### Any alternatives you've considered?

No other solution known

### How would users interact with this feature?

Maybe improve the `emojivoto` demo app, to add more functionality such as NetworkPolicy, etc.

### Would you like to work on this feature?

maybe

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.