Merge pull request #2903 from weaveworks/issues/2754-launch-generator-for-net

Update weave-kube docs and YAML files to leverage Launch Generator
This commit is contained in:
Bryan Boreham authored and GitHub committed 2017-05-26 15:48:14 +01:00
commit a5e4a19f06
4 files changed
+264 -208

No files matched your search

+116 -109
View File
@@ -1,121 +1,128 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: weave-net
rules:
- apiGroups:
- ""
resources:
- pods
- namespaces
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- networkpolicies
verbs:
- get
- list
- watch
---
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: List
metadata: items:
name: weave-net - apiVersion: v1
namespace: kube-system kind: ServiceAccount
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: weave-net
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: weave-net
subjects:
- kind: ServiceAccount
name: weave-net
namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: weave-net
namespace: kube-system
spec:
template:
metadata: metadata:
name: weave-net
labels:
name: weave-net
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: weave-net
labels:
name: weave-net
rules:
- apiGroups:
- ''
resources:
- pods
- namespaces
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- networkpolicies
verbs:
- get
- list
- watch
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: weave-net
labels:
name: weave-net
roleRef:
kind: ClusterRole
name: weave-net
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: weave-net
namespace: kube-system
- apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: weave-net
labels: labels:
name: weave-net name: weave-net
spec: spec:
hostNetwork: true template:
hostPID: true metadata:
containers: labels:
- name: weave name: weave-net
image: weaveworks/weave-kube:latest spec:
imagePullPolicy: Always containers:
command: - name: weave
- /home/weave/launch.sh command:
livenessProbe: - /home/weave/launch.sh
initialDelaySeconds: 30 env: []
httpGet: image: 'weaveworks/weave-kube:latest'
host: 127.0.0.1 imagePullPolicy: Always
path: /status livenessProbe:
port: 6784 httpGet:
host: 127.0.0.1
path: /status
port: 6784
initialDelaySeconds: 30
resources:
requests:
cpu: 10m
securityContext:
privileged: true
volumeMounts:
- name: weavedb
mountPath: /weavedb
- name: cni-bin
mountPath: /host/opt
- name: cni-bin2
mountPath: /host/home
- name: cni-conf
mountPath: /host/etc
- name: dbus
mountPath: /host/var/lib/dbus
- name: lib-modules
mountPath: /lib/modules
- name: weave-npc
image: 'weaveworks/weave-npc:latest'
imagePullPolicy: Always
resources:
requests:
cpu: 10m
securityContext:
privileged: true
hostNetwork: true
hostPID: true
restartPolicy: Always
securityContext: securityContext:
privileged: true seLinuxOptions:
volumeMounts: type: spc_t
serviceAccountName: weave-net
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
volumes:
- name: weavedb - name: weavedb
mountPath: /weavedb hostPath:
path: /var/lib/weave
- name: cni-bin - name: cni-bin
mountPath: /host/opt hostPath:
path: /opt
- name: cni-bin2 - name: cni-bin2
mountPath: /host/home hostPath:
path: /home
- name: cni-conf - name: cni-conf
mountPath: /host/etc hostPath:
path: /etc
- name: dbus - name: dbus
mountPath: /host/var/lib/dbus hostPath:
path: /var/lib/dbus
- name: lib-modules - name: lib-modules
mountPath: /lib/modules hostPath:
resources: path: /lib/modules
requests:
cpu: 10m
- name: weave-npc
image: weaveworks/weave-npc:latest
imagePullPolicy: Always
resources:
requests:
cpu: 10m
securityContext:
privileged: true
restartPolicy: Always
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
serviceAccountName: weave-net
securityContext:
seLinuxOptions:
type: spc_t
volumes:
- name: weavedb
hostPath:
path: /var/lib/weave
- name: cni-bin
hostPath:
path: /opt
- name: cni-bin2
hostPath:
path: /home
- name: cni-conf
hostPath:
path: /etc
- name: dbus
hostPath:
path: /var/lib/dbus
- name: lib-modules
hostPath:
path: /lib/modules
+78 -70
View File
@@ -1,81 +1,89 @@
apiVersion: extensions/v1beta1 apiVersion: v1
kind: DaemonSet kind: List
metadata: items:
name: weave-net - apiVersion: v1
namespace: kube-system kind: ServiceAccount
spec:
template:
metadata: metadata:
name: weave-net
labels:
name: weave-net
- apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: weave-net
labels: labels:
name: weave-net name: weave-net
annotations:
scheduler.alpha.kubernetes.io/tolerations: |
[
{
"key": "dedicated",
"operator": "Equal",
"value": "master",
"effect": "NoSchedule"
}
]
spec: spec:
hostNetwork: true template:
hostPID: true metadata:
containers: annotations:
- name: weave scheduler.alpha.kubernetes.io/tolerations: >-
image: weaveworks/weave-kube:latest [{"key":"dedicated","operator":"Equal","value":"master","effect":"NoSchedule"}]
imagePullPolicy: Always labels:
command: name: weave-net
- /home/weave/launch.sh spec:
livenessProbe: containers:
initialDelaySeconds: 30 - name: weave
httpGet: command:
host: 127.0.0.1 - /home/weave/launch.sh
path: /status env: []
port: 6784 image: 'weaveworks/weave-kube:latest'
imagePullPolicy: Always
livenessProbe:
httpGet:
host: 127.0.0.1
path: /status
port: 6784
initialDelaySeconds: 30
resources:
requests:
cpu: 10m
securityContext:
privileged: true
volumeMounts:
- name: weavedb
mountPath: /weavedb
- name: cni-bin
mountPath: /host/opt
- name: cni-bin2
mountPath: /host/home
- name: cni-conf
mountPath: /host/etc
- name: dbus
mountPath: /host/var/lib/dbus
- name: lib-modules
mountPath: /lib/modules
- name: weave-npc
image: 'weaveworks/weave-npc:latest'
imagePullPolicy: Always
resources:
requests:
cpu: 10m
securityContext:
privileged: true
hostNetwork: true
hostPID: true
restartPolicy: Always
securityContext: securityContext:
privileged: true seLinuxOptions:
volumeMounts: type: spc_t
serviceAccountName: weave-net
volumes:
- name: weavedb - name: weavedb
mountPath: /weavedb hostPath:
path: /var/lib/weave
- name: cni-bin - name: cni-bin
mountPath: /host/opt hostPath:
path: /opt
- name: cni-bin2 - name: cni-bin2
mountPath: /host/home hostPath:
path: /home
- name: cni-conf - name: cni-conf
mountPath: /host/etc hostPath:
path: /etc
- name: dbus - name: dbus
mountPath: /host/var/lib/dbus hostPath:
path: /var/lib/dbus
- name: lib-modules - name: lib-modules
mountPath: /lib/modules hostPath:
resources: path: /lib/modules
requests:
cpu: 10m
- name: weave-npc
image: weaveworks/weave-npc:latest
imagePullPolicy: Always
resources:
requests:
cpu: 10m
securityContext:
privileged: true
restartPolicy: Always
volumes:
- name: weavedb
hostPath:
path: /var/lib/weave
- name: cni-bin
hostPath:
path: /opt
- name: cni-bin2
hostPath:
path: /home
- name: cni-conf
hostPath:
path: /etc
- name: dbus
hostPath:
path: /var/lib/dbus
- name: lib-modules
hostPath:
path: /lib/modules
+61 -26
View File
@@ -21,16 +21,8 @@ The following topics are discussed:
Weave Net can be installed onto your CNI-enabled Kubernetes cluster Weave Net can be installed onto your CNI-enabled Kubernetes cluster
with a single command: with a single command:
* Kubernetes versions `1.6` and above:
``` ```
$ kubectl apply -f https://git.io/weave-kube-1.6 $ kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
```
* Kubernetes versions up to `1.5`:
```
$ kubectl apply -f https://git.io/weave-kube
``` ```
After a few seconds, a Weave Net pod should be running on each After a few seconds, a Weave Net pod should be running on each
@@ -63,10 +55,20 @@ Shut down Kubernetes, and _on all nodes_ perform the following:
Then relaunch Kubernetes and install the addon as described Then relaunch Kubernetes and install the addon as described
above. above.
The URLs [https://git.io/weave-kube](https://git.io/weave-kube) and [https://git.io/weave-kube-1.6](https://git.io/weave-kube-1.6) point **Note:** The URLs:
to the YAML file for the [latest release](https://github.com/weaveworks/weave/releases/tag/latest_release) of the Weave Net addon.
Historic versions are archived on our [GitHub release - [https://git.io/weave-kube](https://git.io/weave-kube), and
page](https://github.com/weaveworks/weave/releases). - [https://git.io/weave-kube-1.6](https://git.io/weave-kube-1.6)
point to:
- [https://cloud.weave.works/k8s/v1.5/net](https://cloud.weave.works/k8s/v1.5/net), and
- [https://cloud.weave.works/k8s/v1.6/net](https://cloud.weave.works/k8s/v1.6/net).
In the past, these URLs pointed to the static YAML files for the [latest release](https://github.com/weaveworks/weave/releases/tag/latest_release) of the Weave Net addon, respectively:
- [`latest_release/weave-daemonset.yaml`](https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset.yaml) and
- [`latest_release/weave-daemonset-k8s-1.6.yaml`](https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset-k8s-1.6.yaml).
## <a name="kube-1.6-upgrade"></a> Upgrading Kubernetes to version 1.6 ## <a name="kube-1.6-upgrade"></a> Upgrading Kubernetes to version 1.6
@@ -205,21 +207,16 @@ 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
The default configuration settings can be changed by saving and editing the #### Using `cloud.weave.works`
addon YAML before running `kubectl apply`. Additional arguments may be
supplied to the Weave router process by adding them to the `command:`
array in the YAML file.
Some parameters are changed by environment variables; these can be If the YAML file is from `cloud.weave.works` as described above, then you can customise it by passing some of Weave Net's options, arguments and environment variables as query parameters:
inserted into the YAML file like this:
``` - `version`: Weave Net's version. Default: `latest`, i.e. latest release. *N.B.*: This only changes the specified version inside the generated YAML file, it does not ensure that the rest of the YAML is compatible with that version. To freeze the YAML version save a copy of the YAML file from the [release page](https://github.com/weaveworks/weave/releases) and use that copy instead of downloading it each time from `cloud.weave.works`.
containers: - `known-peers`: comma-separated list of hosts. Default: empty.
- name: weave - `trusted-subnets`: comma-separated list of CIDRs. Default: empty.
env: - `disable-npc`: boolean (`true|false`). Default: `false`.
- name: IPALLOC_RANGE - `enable-encryption`: boolean (`true|false`). Default: `false`.
value: 10.0.0.0/16 - `env.NAME=VALUE`: add environment variable `NAME` and set it to `VALUE`.
```
The list of variables you can set is: The list of variables you can set is:
@@ -241,3 +238,41 @@ The list of variables you can set is:
a larger size for better performance if your network supports jumbo a larger size for better performance if your network supports jumbo
frames - see [here](/site/using-weave/fastdp.md#mtu) for more frames - see [here](/site/using-weave/fastdp.md#mtu) for more
details. details.
Example:
```
$ kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&env.WEAVE_MTU=1337"
```
This command -- notice `&env.WEAVE_MTU=1337` at the end of the URL -- generates a YAML file containing, among others:
```
[...]
containers:
- name: weave
[...]
env:
- name: WEAVE_MTU
value: '1337'
[...]
```
**Note**: The YAML file can also be saved for later use or manual editing by using, for example:
```
$ curl -fsSLo weave-daemonset.yaml "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
```
#### Manually editing the YAML file
Whether you saved the YAML file served from `cloud.weave.works` or downloaded a static YAML file from our [releases page](https://github.com/weaveworks/weave/releases), you can manually edit it to suit your needs.
For example,
- additional arguments may be supplied to the Weave router process by adding them to the `command:` array in the YAML file,
- additional parameters can be set via the environment variables listed above; these can be inserted into the YAML file like this:
```
containers:
- name: weave
env:
- name: IPALLOC_RANGE
value: 10.0.0.0/16
```
+9 -3
View File
@@ -38,10 +38,16 @@ for host in $HOSTS; do
fi fi
done done
[ -n "$COVERAGE" ] && COVERAGE_ARGS="\\n env:\\n - name: EXTRA_ARGS\\n value: \"-test.coverprofile=/home/weave/cover.prof --\"" if [ -n "$COVERAGE" ]; then
COVERAGE_ARGS="env:\\n - name: EXTRA_ARGS\\n value: \"-test.coverprofile=/home/weave/cover.prof --\""
else
COVERAGE_ARGS="env: []"
fi
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never$COVERAGE_ARGS%" "$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.6.yaml" \ # Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
| run_on $HOST1 "$KUBECTL apply -f -" sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
-e "s%env: \[\]%$COVERAGE_ARGS%" \
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.6.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
sleep 5 sleep 5