2017-04-10 17:26:28 +00:00
---
2018-02-18 19:29:37 +00:00
reviewers:
2017-04-10 17:26:28 +00:00
- bboreham
2017-06-08 22:13:29 +00:00
title: Weave Net for NetworkPolicy
2018-05-05 16:00:51 +00:00
content_template: templates/task
2018-05-20 03:54:51 +00:00
weight: 50
2017-04-10 17:26:28 +00:00
---
2018-05-05 16:00:51 +00:00
{{% capture overview %}}
2017-04-10 17:26:28 +00:00
2017-05-14 21:58:15 +00:00
This page shows how to use Weave Net for NetworkPolicy.
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-05-14 21:58:15 +00:00
2018-05-05 16:00:51 +00:00
{{% capture prerequisites %}}
2017-05-14 21:58:15 +00:00
2018-01-25 22:29:40 +00:00
You need to have a Kubernetes cluster. Follow the [kubeadm getting started guide ](/docs/getting-started-guides/kubeadm/ ) to bootstrap one.
2017-05-14 21:58:15 +00:00
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-05-14 21:58:15 +00:00
2018-05-05 16:00:51 +00:00
{{% capture steps %}}
2017-05-14 21:58:15 +00:00
2017-10-19 17:43:05 +00:00
## Install the Weave Net addon
2017-05-14 21:58:15 +00:00
2017-05-15 23:52:16 +00:00
Follow the [Integrating Kubernetes via the Addon ](https://www.weave.works/docs/net/latest/kube-addon/ ) guide.
2017-05-14 21:58:15 +00:00
2017-10-19 17:43:05 +00:00
The Weave Net addon for Kubernetes comes with a [Network Policy Controller ](https://www.weave.works/docs/net/latest/kube-addon/#npc ) that automatically monitors Kubernetes for any NetworkPolicy annotations on all namespaces and configures `iptables` rules to allow or block traffic as directed by the policies.
2017-08-09 05:49:09 +00:00
2017-10-19 17:43:05 +00:00
## Test the installation
2018-01-25 22:29:40 +00:00
Verify that the weave works.
2017-10-19 17:43:05 +00:00
Enter the following command:
```shell
2018-09-24 22:50:39 +00:00
kubectl get pods -n kube-system -o wide
2017-10-19 17:43:05 +00:00
```
The output is similar to this:
```
NAME READY STATUS RESTARTS AGE IP NODE
2018-03-13 16:41:12 +00:00
weave-net-1t1qg 2/2 Running 0 9d 192.168.2.10 worknode3
2017-10-19 17:43:05 +00:00
weave-net-231d7 2/2 Running 1 7d 10.2.0.17 worknodegpu
weave-net-7nmwt 2/2 Running 3 9d 192.168.2.131 masternode
weave-net-pmw8w 2/2 Running 0 9d 192.168.2.216 worknode2
```
Each Node has a weave Pod, and all Pods are `Running` and `2/2 READY` . (`2/2` means that each Pod has `weave` and `weave-npc` .)
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-08-09 05:49:09 +00:00
2018-05-05 16:00:51 +00:00
{{% capture whatsnext %}}
2017-04-10 17:26:28 +00:00
2018-01-25 22:29:40 +00:00
Once you have installed the Weave Net addon, you can follow the [Declare Network Policy ](/docs/tasks/administer-cluster/declare-network-policy/ ) to try out Kubernetes NetworkPolicy. If you have any question, contact us at [#weave-community on Slack or Weave User Group ](https://github.com/weaveworks/weave#getting-help ).
2017-05-14 21:58:15 +00:00
2018-05-05 16:00:51 +00:00
{{% /capture %}}
2017-05-14 21:58:15 +00:00