Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3aff5f2467 | ||
|
|
0c63a8d0e5 | ||
|
|
65b45e8dd1 | ||
|
|
03885d4b40 | ||
|
|
40e78fea99 | ||
|
|
ecba88e445 | ||
|
|
29c9b2c064 | ||
|
|
6a871d13a6 | ||
|
|
c2a224b436 | ||
|
|
dd8d4b1d9b | ||
|
|
527bcffe3b | ||
|
|
de1d409c6a | ||
|
|
2555e491e1 |
No files matched your search
@@ -1,3 +1,21 @@
|
|||||||
|
## Release 2.0.4
|
||||||
|
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
* weave-npc failed on Centos 7, due to older 'ipset' version in kernel #3099,#3100
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/62?closed=1).
|
||||||
|
|
||||||
|
|
||||||
|
## Release 2.0.3
|
||||||
|
|
||||||
|
Bug fixes
|
||||||
|
|
||||||
|
* Weave-npc would crash on a policy with no 'from' part - regression introduced in 2.0.2 #3095,#3096,#3097
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/61?closed=1).
|
||||||
|
|
||||||
|
|
||||||
## Release 2.0.2
|
## Release 2.0.2
|
||||||
|
|
||||||
Bug fixes and minor improvements
|
Bug fixes and minor improvements
|
||||||
|
|||||||
+26
-3
@@ -33,14 +33,33 @@ type Interface interface {
|
|||||||
type ipset struct {
|
type ipset struct {
|
||||||
refCount
|
refCount
|
||||||
*log.Logger
|
*log.Logger
|
||||||
|
enableComments bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(logger *log.Logger) Interface {
|
func New(logger *log.Logger) Interface {
|
||||||
return &ipset{refCount: newRefCount(), Logger: logger}
|
ips := &ipset{refCount: newRefCount(), Logger: logger, enableComments: true}
|
||||||
|
|
||||||
|
// Check for comment support
|
||||||
|
testIpsetName := Name("weave-test-comment")
|
||||||
|
// Clear it out if it already exists
|
||||||
|
_ = ips.Destroy(testIpsetName)
|
||||||
|
// Test for comment support
|
||||||
|
if err := ips.Create(testIpsetName, HashIP); err != nil {
|
||||||
|
ips.Logger.Printf("failed to create %s; disabling comment support", testIpsetName)
|
||||||
|
ips.enableComments = false
|
||||||
|
}
|
||||||
|
// If it was created, destroy it
|
||||||
|
_ = ips.Destroy(testIpsetName)
|
||||||
|
|
||||||
|
return ips
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
func (i *ipset) Create(ipsetName Name, ipsetType Type) error {
|
||||||
return doExec("create", string(ipsetName), string(ipsetType), "comment")
|
args := []string{"create", string(ipsetName), string(ipsetType)}
|
||||||
|
if i.enableComments {
|
||||||
|
args = append(args, "comment")
|
||||||
|
}
|
||||||
|
return doExec(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) AddEntry(ipsetName Name, entry string, comment string) error {
|
func (i *ipset) AddEntry(ipsetName Name, entry string, comment string) error {
|
||||||
@@ -48,7 +67,11 @@ func (i *ipset) AddEntry(ipsetName Name, entry string, comment string) error {
|
|||||||
if i.inc(ipsetName, entry) > 1 { // already in the set
|
if i.inc(ipsetName, entry) > 1 { // already in the set
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return doExec("add", string(ipsetName), entry, "comment", comment)
|
args := []string{"add", string(ipsetName), entry}
|
||||||
|
if i.enableComments {
|
||||||
|
args = append(args, "comment", comment)
|
||||||
|
}
|
||||||
|
return doExec(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
func (i *ipset) DelEntry(ipsetName Name, entry string) error {
|
||||||
|
|||||||
+9
-7
@@ -20,23 +20,25 @@ func newRuleSpec(proto *string, srcHost *selectorSpec, dstHost *selectorSpec, ds
|
|||||||
if proto != nil {
|
if proto != nil {
|
||||||
args = append(args, "-p", *proto)
|
args = append(args, "-p", *proto)
|
||||||
}
|
}
|
||||||
|
srcComment := "anywhere"
|
||||||
if srcHost != nil {
|
if srcHost != nil {
|
||||||
args = append(args, "-m", "set", "--match-set", string(srcHost.ipsetName), "src")
|
args = append(args, "-m", "set", "--match-set", string(srcHost.ipsetName), "src")
|
||||||
|
if srcHost.nsName != "" {
|
||||||
|
srcComment = fmt.Sprintf("pods: namespace: %s, selector: %s", srcHost.nsName, srcHost.key)
|
||||||
|
} else {
|
||||||
|
srcComment = fmt.Sprintf("namespaces: selector: %s", srcHost.key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
dstComment := "anywhere"
|
||||||
if dstHost != nil {
|
if dstHost != nil {
|
||||||
args = append(args, "-m", "set", "--match-set", string(dstHost.ipsetName), "dst")
|
args = append(args, "-m", "set", "--match-set", string(dstHost.ipsetName), "dst")
|
||||||
|
dstComment = fmt.Sprintf("pods: namespace: %s, selector: %s", dstHost.nsName, dstHost.key)
|
||||||
}
|
}
|
||||||
if dstPort != nil {
|
if dstPort != nil {
|
||||||
args = append(args, "--dport", *dstPort)
|
args = append(args, "--dport", *dstPort)
|
||||||
}
|
}
|
||||||
args = append(args, "-j", "ACCEPT")
|
args = append(args, "-j", "ACCEPT")
|
||||||
srcComment := ""
|
args = append(args, "-m", "comment", "--comment", fmt.Sprintf("%s -> %s", srcComment, dstComment))
|
||||||
if srcHost.nsName != "" {
|
|
||||||
srcComment = fmt.Sprintf("pods: namespace: %s, selector: %s", srcHost.nsName, srcHost.key)
|
|
||||||
} else {
|
|
||||||
srcComment = fmt.Sprintf("namespaces: selector: %s", srcHost.key)
|
|
||||||
}
|
|
||||||
args = append(args, "-m", "comment", "--comment", fmt.Sprintf("%s -> namespace: %s, key: %s", srcComment, dstHost.nsName, dstHost.key))
|
|
||||||
key := strings.Join(args, " ")
|
key := strings.Join(args, " ")
|
||||||
|
|
||||||
return &ruleSpec{key, args}
|
return &ruleSpec{key, args}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package npc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRegressionHandleNil3095(t *testing.T) {
|
||||||
|
// Test for handling nil values
|
||||||
|
// https://github.com/weaveworks/weave/issues/3095
|
||||||
|
|
||||||
|
rs := newRuleSpec(nil, nil, nil, nil)
|
||||||
|
|
||||||
|
require.NotEqual(t, rs.key, "")
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,8 +12,9 @@ The following topics are discussed:
|
|||||||
* [CPU and Memory Requirements](#resources)
|
* [CPU and Memory Requirements](#resources)
|
||||||
* [Pod Eviction](#eviction)
|
* [Pod Eviction](#eviction)
|
||||||
* [Network Policy Controller](#npc)
|
* [Network Policy Controller](#npc)
|
||||||
|
* [Troubleshooting](#troubleshooting)
|
||||||
* [Troubleshooting Blocked Connections](#blocked-connections)
|
* [Troubleshooting Blocked Connections](#blocked-connections)
|
||||||
* [Changing Configuration Options](#configuration-options)
|
* [Changing Configuration Options](#configuration-options)
|
||||||
|
|
||||||
|
|
||||||
## <a name="install"></a> Installation
|
## <a name="install"></a> Installation
|
||||||
@@ -83,8 +84,8 @@ and so you will need to perform the procedure manually:
|
|||||||
* Apply the updated addon manifest `kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"`
|
* Apply the updated addon manifest `kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"`
|
||||||
* Kill each Weave Net pod with `kubectl delete` and then wait for it to reboot before moving on to the next pod.
|
* Kill each Weave Net pod with `kubectl delete` and then wait for it to reboot before moving on to the next pod.
|
||||||
|
|
||||||
**Note:** If you delete all Weave Net pods at the same time they will
|
**Note:** In versions prior to Weave Net 2.0, deleting all Weave Net pods at the same time
|
||||||
lose track of IP address range ownership, possibly leading to
|
will result in them losing track of IP address range ownership, possibly leading to
|
||||||
duplicate IP addresses if you then start a new copy of Weave Net.
|
duplicate IP addresses if you then start a new copy of Weave Net.
|
||||||
|
|
||||||
## <a name="resources"></a>CPU and Memory Requirements
|
## <a name="resources"></a>CPU and Memory Requirements
|
||||||
@@ -163,6 +164,80 @@ definition](http://kubernetes.io/docs/api-reference/extensions/v1beta1/definitio
|
|||||||
all multicast traffic) by adding `--allow-mcast=false` as an
|
all multicast traffic) by adding `--allow-mcast=false` as an
|
||||||
argument to `weave-npc` in the YAML configuration.
|
argument to `weave-npc` in the YAML configuration.
|
||||||
|
|
||||||
|
## <a name="troubleshooting"></a><a name="troubleshooting"></a> Troubleshooting
|
||||||
|
|
||||||
|
The status of Weave Net can be checked by running its CLI commands. This can be done in various ways:
|
||||||
|
|
||||||
|
1\. [Install the `weave` script](/site/installing-weave.md) and run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ weave status
|
||||||
|
Version: 2.0.1 (up to date; next check at 2017/07/10 13:49:29)
|
||||||
|
|
||||||
|
Service: router
|
||||||
|
Protocol: weave 1..2
|
||||||
|
Name: 42:8e:e8:c4:52:1b(host-0)
|
||||||
|
Encryption: disabled
|
||||||
|
PeerDiscovery: enabled
|
||||||
|
Targets: 3
|
||||||
|
Connections: 3 (2 established, 1 failed)
|
||||||
|
Peers: 3 (with 6 established connections)
|
||||||
|
TrustedSubnets: none
|
||||||
|
|
||||||
|
Service: ipam
|
||||||
|
Status: ready
|
||||||
|
Range: 10.32.0.0/12
|
||||||
|
DefaultSubnet: 10.32.0.0/12
|
||||||
|
```
|
||||||
|
|
||||||
|
2\. If you don't want to install additional software onto your hosts, run via `kubectl` commands, which produce the exact same outcome as the previous example:
|
||||||
|
|
||||||
|
```
|
||||||
|
### Identify the Weave Net pods:
|
||||||
|
|
||||||
|
$ kubectl get pods -n kube-system -l name=weave-net -o wide
|
||||||
|
NAME READY STATUS RESTARTS AGE IP NODE
|
||||||
|
weave-net-1jkl6 2/2 Running 0 1d 10.128.0.4 host-0
|
||||||
|
weave-net-bskbv 2/2 Running 0 1d 10.128.0.5 host-1
|
||||||
|
weave-net-m4x1b 2/2 Running 0 1d 10.128.0.6 host-2
|
||||||
|
```
|
||||||
|
|
||||||
|
The above shows all Weave Net pods available in your cluster.
|
||||||
|
You can see Kubernetes has deployed one Weave Net pod per host, in order to interconnect all hosts.
|
||||||
|
|
||||||
|
You then need to:
|
||||||
|
- choose which pod you want to run your command from (in most cases it doesn't matter
|
||||||
|
which one you pick so just pick the first one, e.g. pod `weave-net-1jkl6` here)
|
||||||
|
- use `kubectl exec` to run the `weave status` command
|
||||||
|
- specify the absolute path `/home/weave/weave` and add `--local` because it's running inside a container
|
||||||
|
|
||||||
|
```
|
||||||
|
$ kubectl exec -n kube-system weave-net-1jkl6 -c weave -- /home/weave/weave --local status
|
||||||
|
|
||||||
|
Version: 2.0.1 (up to date; next check at 2017/07/10 13:49:29)
|
||||||
|
|
||||||
|
Service: router
|
||||||
|
Protocol: weave 1..2
|
||||||
|
Name: 42:8e:e8:c4:52:1b(host-0)
|
||||||
|
Encryption: disabled
|
||||||
|
PeerDiscovery: enabled
|
||||||
|
Targets: 3
|
||||||
|
Connections: 3 (2 established, 1 failed)
|
||||||
|
Peers: 3 (with 6 established connections)
|
||||||
|
TrustedSubnets: none
|
||||||
|
|
||||||
|
Service: ipam
|
||||||
|
Status: ready
|
||||||
|
Range: 10.32.0.0/12
|
||||||
|
DefaultSubnet: 10.32.0.0/12
|
||||||
|
```
|
||||||
|
|
||||||
|
3\. Finally you could also use [Weave Cloud](https://cloud.weave.works/) and monitor all your pods, including Weave Net's ones, from there.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
For more information see [What is Weave Cloud?](https://www.weave.works/faq/weave-cloud-faq/)
|
||||||
|
|
||||||
### <a name="blocked-connections"></a> Troubleshooting Blocked Connections
|
### <a name="blocked-connections"></a> Troubleshooting Blocked Connections
|
||||||
|
|
||||||
If you suspect that legitimate traffic is being blocked by the Weave Network Policy Controller, the first thing to do is check the `weave-npc` container's logs.
|
If you suspect that legitimate traffic is being blocked by the Weave Network Policy Controller, the first thing to do is check the `weave-npc` container's logs.
|
||||||
@@ -195,7 +270,7 @@ TCP connection from 10.32.0.7:56648 to 10.32.0.11:80 blocked by Weave NPC.
|
|||||||
UDP connection from 10.32.0.7:56648 to 10.32.0.11:80 blocked by Weave NPC.
|
UDP connection from 10.32.0.7:56648 to 10.32.0.11:80 blocked by Weave NPC.
|
||||||
```
|
```
|
||||||
|
|
||||||
### <a name="configuration-options"></a> Changing Configuration Options
|
## <a name="configuration-options"></a> Changing Configuration Options
|
||||||
|
|
||||||
#### Using `cloud.weave.works`
|
#### Using `cloud.weave.works`
|
||||||
|
|
||||||
@@ -277,72 +352,3 @@ For example,
|
|||||||
- name: IPALLOC_RANGE
|
- name: IPALLOC_RANGE
|
||||||
value: 10.0.0.0/16
|
value: 10.0.0.0/16
|
||||||
```
|
```
|
||||||
|
|
||||||
## <a name="operations"></a> Operations
|
|
||||||
|
|
||||||
When using the Kubernetes addon, Weave Net's peers are managed via Kubernetes and very little effort should be required from your end to operate your network.
|
|
||||||
|
|
||||||
However, should you need it, you can still run `weave` CLI commands to, for example, confirm Weave Net' status. This can be done in various ways:
|
|
||||||
|
|
||||||
1. You could [install the `weave` script](/site/installing-weave.md) and run the same commands you would run without Kubernetes:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ weave status
|
|
||||||
Version: 2.0.1 (up to date; next check at 2017/07/10 13:49:29)
|
|
||||||
|
|
||||||
Service: router
|
|
||||||
Protocol: weave 1..2
|
|
||||||
Name: 42:8e:e8:c4:52:1b(host-0)
|
|
||||||
Encryption: disabled
|
|
||||||
PeerDiscovery: enabled
|
|
||||||
Targets: 3
|
|
||||||
Connections: 3 (2 established, 1 failed)
|
|
||||||
Peers: 3 (with 6 established connections)
|
|
||||||
TrustedSubnets: none
|
|
||||||
|
|
||||||
Service: ipam
|
|
||||||
Status: ready
|
|
||||||
Range: 10.32.0.0/12
|
|
||||||
DefaultSubnet: 10.32.0.0/12
|
|
||||||
```
|
|
||||||
|
|
||||||
2. If you do not want to install anything else on your hosts, you can use the following `kubectl` commands, which will produce the exact same outcome as the previous example:
|
|
||||||
|
|
||||||
```
|
|
||||||
### Identify the Weave Net pods:
|
|
||||||
|
|
||||||
$ kubectl get pods --all-namespaces -o wide | grep weave
|
|
||||||
kube-system weave-net-1jkl6 2/2 Running 0 1d 10.128.0.4 host-0
|
|
||||||
kube-system weave-net-bskbv 2/2 Running 0 1d 10.128.0.5 host-1
|
|
||||||
kube-system weave-net-m4x1b 2/2 Running 0 1d 10.128.0.6 host-2
|
|
||||||
|
|
||||||
### The above shows all Weave Net pods available in your cluster.
|
|
||||||
### You can see Kubernetes has deployed one Weave Net pod per host, in order to interconnect all hosts.
|
|
||||||
|
|
||||||
### You then need to:
|
|
||||||
### - choose which pod you want to run your command from (e.g.: here, pod weave-net-1jkl6, running on host-0), and
|
|
||||||
### - make sure you pass --local to weave, in addition to your command:
|
|
||||||
|
|
||||||
$ kubectl exec -n kube-system weave-net-1jkl6 -- /home/weave/weave --local status
|
|
||||||
Defaulting container name to weave.
|
|
||||||
Use 'kubectl describe pod/weave-net-1jkl6' to see all of the containers in this pod.
|
|
||||||
|
|
||||||
Version: 2.0.1 (up to date; next check at 2017/07/10 13:49:29)
|
|
||||||
|
|
||||||
Service: router
|
|
||||||
Protocol: weave 1..2
|
|
||||||
Name: 42:8e:e8:c4:52:1b(host-0)
|
|
||||||
Encryption: disabled
|
|
||||||
PeerDiscovery: enabled
|
|
||||||
Targets: 3
|
|
||||||
Connections: 3 (2 established, 1 failed)
|
|
||||||
Peers: 3 (with 6 established connections)
|
|
||||||
TrustedSubnets: none
|
|
||||||
|
|
||||||
Service: ipam
|
|
||||||
Status: ready
|
|
||||||
Range: 10.32.0.0/12
|
|
||||||
DefaultSubnet: 10.32.0.0/12
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Finally you could also use [Weave Cloud](https://cloud.weave.works/) and monitor all your pods, including Weave Net's ones, from there.
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
@@ -94,6 +94,20 @@ spec:
|
|||||||
run: nettest
|
run: nettest
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Another policy, this time with no 'from' section, just to check that doesn't cause a crash
|
||||||
|
run_on $HOST1 "$KUBECTL apply -f -" <<EOF
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: test840f
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- {}
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
run: norealpods
|
||||||
|
EOF
|
||||||
|
|
||||||
check_ready() {
|
check_ready() {
|
||||||
run_on $HOST1 "$KUBECTL get nodes | grep -c -w Ready | grep $NUM_HOSTS"
|
run_on $HOST1 "$KUBECTL get nodes | grep -c -w Ready | grep $NUM_HOSTS"
|
||||||
}
|
}
|
||||||
@@ -135,6 +149,9 @@ assert_raises 'wait_for_x check_all_pods_communicate pods'
|
|||||||
# Check that a pod can contact the outside world
|
# Check that a pod can contact the outside world
|
||||||
assert_raises "$SSH $HOST1 $KUBECTL exec $podName -- $PING 8.8.8.8"
|
assert_raises "$SSH $HOST1 $KUBECTL exec $podName -- $PING 8.8.8.8"
|
||||||
|
|
||||||
|
# Check that our pods haven't crashed
|
||||||
|
assert "$SSH $HOST1 $KUBECTL get pods -n kube-system -l name=weave-net | grep -c Running" 3
|
||||||
|
|
||||||
tear_down_kubeadm
|
tear_down_kubeadm
|
||||||
|
|
||||||
# Destroy our test ipset, and implicitly check it is still there
|
# Destroy our test ipset, and implicitly check it is still there
|
||||||
|
|||||||
Reference in new issue
Block a user