Skip to content

Commit a180a27

Browse files
authored
Merge pull request #188477 from miwithro/patch-122
Update operator-best-practices-cluster-security.md
2 parents 57fa9ad + 36634f4 commit a180a27

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

articles/aks/operator-best-practices-cluster-security.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,34 @@ Meanwhile, let's say you bind the individual user directly to a role and their j
4444

4545
For more information about Azure AD integration, Kubernetes RBAC, and Azure RBAC, see [Best practices for authentication and authorization in AKS][aks-best-practices-identity].
4646

47+
## Restrict access to Instance Metadata API
48+
49+
> **Best practice guidance**
50+
>
51+
> Add a network policy in all user namespaces to block pod egress to the metadata endpoint.
52+
53+
```yaml
54+
apiVersion: networking.k8s.io/v1
55+
kind: NetworkPolicy
56+
metadata:
57+
name: restrict-instance-metadata
58+
spec:
59+
podSelector:
60+
matchLabels: {}
61+
policyTypes:
62+
- Egress
63+
egress:
64+
- to:
65+
- ipBlock:
66+
cidr: 10.10.0.0/0#example
67+
except:
68+
- 169.254.169.254/32
69+
```
70+
71+
> [!NOTE]
72+
> Alternatively you can use [Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) thought this is in Public Preview. It has a pod (NMI) that runs as a DaemonSet on each node in the AKS cluster. NMI intercepts security token requests to the Azure Instance Metadata Service on each node, redirect them to itself and validates if the pod has access to the identity it's requesting a token for and fetch the token from the Azure AD tenant on behalf of the application.
73+
>
74+
4775
## Secure container access to resources
4876
4977
> **Best practice guidance**

0 commit comments

Comments
 (0)