Skip to content

Commit 5daf5f4

Browse files
docs: [NPM] add windows documentation and update links to MSDocs (#1805)
* add windows and update doc links * update main README to say NPM supports Windows * update preview wording to be clearer --------- Co-authored-by: Vamsi Kalapala <[email protected]>
1 parent 09cd371 commit 5daf5f4

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This repository contains container networking services and plugins for Linux and
1414

1515
* [Azure CNI network and IPAM plugins](docs/cni.md) for Kubernetes.
1616
* [Azure CNM (libnetwork) network and IPAM plugins](docs/cnm.md) for Docker Engine. **(MAINTENANCE MODE)**
17-
* [Azure NPM - Kubernetes Network Policy Manager](docs/npm.md) (Supports only linux for now).
17+
* [Azure NPM - Kubernetes Network Policy Manager](docs/npm.md) (Linux and (preview) Windows Server 2022)
1818

1919
The `azure-vnet` network plugins connect containers to your [Azure VNET](https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-overview), to take advantage of Azure SDN capabilities. The `azure-vnet-ipam` IPAM plugins provide address management functionality for container IP addresses allocated from Azure VNET address space.
2020

docs/npm.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44

55
`azure-npm` Network Policy plugin implements the [Kubernetes Network Policy](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
66

7-
The plugin is available on Linux platform. Windows support is planned.
7+
The plugin is available on Linux and (preview) Windows Server 2022.
88

99
Azure-NPM serves as a distributed firewall for the Kubernetes cluster, and it can be easily controlled by `kubectl`.
1010

11+
## Documentation
12+
1. [Secure traffic between pods using network policies in Azure Kubernetes Service (AKS)](https://learn.microsoft.com/en-us/azure/aks/use-network-policies)
13+
2. [Monitor and Visualize Network Configurations with Azure NPM](https://learn.microsoft.com/en-us/azure/virtual-network/kubernetes-network-policies#monitor-and-visualize-network-configurations-with-azure-npm)
14+
1115
## Install
16+
Specify `--network-policy=azure` when creating an AKS cluster. For more information, see the [Microsoft Docs](https://learn.microsoft.com/en-us/azure/aks/use-network-policies#create-an-aks-cluster-and-enable-network-policy).
1217

18+
### Manual Installation
1319
Running the command below will bring up one azure-npm instance on each Kubernetes node.
1420
```
21+
# linux
1522
kubectl apply -f https://raw.githubusercontent.com/Azure/azure-container-networking/master/npm/deploy/npm/azure-npm.yaml
23+
# windows
24+
kubectl apply -f https://raw.githubusercontent.com/Azure/azure-container-networking/master/npm/examples/windows/azure-npm.yaml
1625
```
1726
Now you can secure your Kubernetes cluster with Azure-NPM by applying Kubernetes network policies.
1827

1928
## Build
20-
29+
### Linux
2130
`azure-npm` can be built directly from the source code in this repository.
2231
```
2332
make azure-npm
@@ -29,16 +38,39 @@ The second command builds the `azure-npm` docker image.
2938
The third command builds the `azure-npm` binary and place it in a tar archive.
3039
The binaries are placed in the `output` directory.
3140

32-
## Usage
41+
### Windows
42+
```
43+
$env:ACN_PACKAGE_PATH = "github.com/Azure/azure-container-networking"
44+
$env:NPM_AI_PATH = "$env:ACN_PACKAGE_PATH/npm.aiMetadata"
45+
$env:NPM_AI_ID = "1234abcd-1234-abcd-1234-12345678abcd"
46+
$env:VERSION = "0.0.0"
47+
$env:REPO = "mcr.microsoft.com/azure-npm:" # include colon at end
48+
$env:IMAGE = "$env:REPO$env:VERSION"
49+
docker build `
50+
-f npm/windows.Dockerfile `
51+
-t $env:IMAGE `
52+
--build-arg VERSION=$env:VERSION `
53+
--build-arg NPM_AI_PATH=$env:NPM_AI_PATH `
54+
--build-arg NPM_AI_ID=$env:NPM_AI_ID `
55+
.
56+
docker push $env:IMAGE
57+
echo $env:IMAGE
58+
```
3359

34-
Microsoft docs has a detailed step by step example on how to use Kubernetes network policy.
35-
1. [Deny all inbound traffic to a pod](https://docs.microsoft.com/en-us/azure/aks/use-network-policies#deny-all-inbound-traffic-to-a-pod)
36-
2. [Allow inbound traffic based on a pod label](https://docs.microsoft.com/en-us/azure/aks/use-network-policies#allow-inbound-traffic-based-on-a-pod-label)
37-
3. [Allow traffic only from within a defined namespace](https://docs.microsoft.com/en-us/azure/aks/use-network-policies#allow-traffic-only-from-within-a-defined-namespace)
60+
## Usage
61+
[Microsoft Docs](https://learn.microsoft.com/en-us/azure/aks/use-network-policies#verify-network-policy-setup) has a detailed step by step example on how to use Kubernetes network policy.
3862

3963
## Troubleshooting
40-
41-
`azure-npm` translates Kubernetes network policies into a set of `iptables` rules under the hood.
4264
When `azure-npm` isn't working as expected, try to **delete all networkpolicies and apply them again**.
4365
Also, a good practice is to merge all network policies targeting the same set of pods/labels into one yaml file.
4466
This way, operators can keep the minimum number of network policies and makes it easier for operators to troubleshoot.
67+
68+
### Linux
69+
NPM adds firewall rules via `iptables` and `ipset`. You can examine the configuration on a given node with:
70+
- `kubectl exec -it -n kube-system $npmPod -- iptables -vnL`
71+
- `kubectl exec -it -n kube-system $npmPod -- ipset -L`
72+
73+
### Windows
74+
NPM adds firewall rules via HNS. You can examine the configuration on a given node with:
75+
- ACLs applied on Pod Endpoints: `kubectl exec -n kube-system $npmWinPod -- Get-HNSEndpoint`
76+
- SetPolicies are like ipsets: `(Get-HNSNetwork | ? Name -Like Azure).Policies`

0 commit comments

Comments
 (0)