diff --git a/README.md b/README.md index 3cc0012bdb..5a4755a31a 100644 --- a/README.md +++ b/README.md @@ -34,15 +34,19 @@ Flannel can be added to any existing Kubernetes cluster though it's simplest to For Kubernetes v1.17+ #### Deploying Flannel with kubectl -``` + +```bash kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml ``` If you use custom `podCIDR` (not `10.244.0.0/16`) you first need to download the above manifest and modify the network to match your one. #### Deploying Flannel with helm -``` -helm install flannel --set podCidr="10.244.0.0/16" https://github.com/flannel-io/flannel/releases/latest/download/flannel.tgz + +```bash +kubectl create ns kube-flannel +kubectl label --overwrite ns kube-flannel pod-security.kubernetes.io/enforce=privileged +helm install flannel --set podCidr="10.244.0.0/16" --namespace kube-flannel https://github.com/flannel-io/flannel/releases/latest/download/flannel.tgz ``` See [Kubernetes](Documentation/kubernetes.md) for more details. @@ -50,7 +54,8 @@ See [Kubernetes](Documentation/kubernetes.md) for more details. In case a firewall is configured ensure to enable the right port used by the configured [backend][backends]. Flannel uses `portmap` as CNI network plugin by default; when deploying Flannel ensure that the [CNI Network plugins][Network-plugins] are installed in `/opt/cni/bin` the latest binaries can be downloaded with the following commands: -``` + +```bash mkdir -p /opt/cni/bin curl -O -L https://github.com/containernetworking/plugins/releases/download/v1.2.0/cni-plugins-linux-amd64-v1.2.0.tgz tar -C /opt/cni/bin -xzf cni-plugins-linux-amd64-v1.2.0.tgz @@ -61,6 +66,7 @@ tar -C /opt/cni/bin -xzf cni-plugins-linux-amd64-v1.2.0.tgz flannel is also widely used outside of kubernetes. When deployed outside of kubernetes, etcd is always used as the datastore. For more details integrating flannel with Docker see [Running](Documentation/running.md) ## Documentation + - [Building (and releasing)](Documentation/building.md) - [Configuration](Documentation/configuration.md) - [Backends](Documentation/backends.md) @@ -70,11 +76,11 @@ flannel is also widely used outside of kubernetes. When deployed outside of kube ## Contact -* Slack: - * #k3s on [Rancher Users Slack](https://slack.rancher.io) - * #flannel-users on [Calico Users Slack](https://slack.projectcalico.org) -* Planning/Roadmap: [milestones][milestones], [roadmap][roadmap] -* Bugs: [issues][flannel-issues] +- Slack: + - #k3s on [Rancher Users Slack](https://slack.rancher.io) + - #flannel-users on [Calico Users Slack](https://slack.projectcalico.org) +- Planning/Roadmap: [milestones][milestones], [roadmap][roadmap] +- Bugs: [issues][flannel-issues] ## Community Meeting @@ -95,7 +101,6 @@ See [reporting bugs][reporting] for details about reporting any issues. Flannel is under the Apache 2.0 license. See the [LICENSE][license] file for details. [calico]: http://www.projectcalico.org -[pod-cidr]: https://kubernetes.io/docs/admin/kubelet/ [etcd]: https://go.etcd.io/etcd/v3 [contributing]: CONTRIBUTING.md [license]: https://github.com/flannel-io/flannel/blob/master/LICENSE @@ -105,6 +110,5 @@ Flannel is under the Apache 2.0 license. See the [LICENSE][license] file for det [roadmap]: https://github.com/kubernetes/kubernetes/milestones [reporting]: Documentation/reporting_bugs.md [k3s-installer]: https://github.com/k3s-io/k3s/#quick-start---install-script -[installing-with-kubeadm]: https://kubernetes.io/docs/getting-started-guides/kubeadm/ [k3s]: https://k3s.io/ [Network-plugins]: https://github.com/containernetworking/plugins diff --git a/chart/kube-flannel/.helmignore b/chart/kube-flannel/.helmignore new file mode 100644 index 0000000000..1ae9e848d8 --- /dev/null +++ b/chart/kube-flannel/.helmignore @@ -0,0 +1,2 @@ +tests/ +.helmignore diff --git a/chart/kube-flannel/templates/config.yaml b/chart/kube-flannel/templates/config.yaml index 6ddf9f59c5..e147c9ddb9 100644 --- a/chart/kube-flannel/templates/config.yaml +++ b/chart/kube-flannel/templates/config.yaml @@ -2,7 +2,7 @@ kind: ConfigMap apiVersion: v1 metadata: name: kube-flannel-cfg - namespace: kube-flannel + namespace: {{ .Release.Namespace }} labels: tier: node app: flannel diff --git a/chart/kube-flannel/templates/daemonset.yaml b/chart/kube-flannel/templates/daemonset.yaml index 372cd8ed30..af7226db2e 100644 --- a/chart/kube-flannel/templates/daemonset.yaml +++ b/chart/kube-flannel/templates/daemonset.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: kube-flannel-ds - namespace: kube-flannel + namespace: {{ .Release.Namespace }} labels: tier: node app: flannel diff --git a/chart/kube-flannel/templates/namespace.yaml b/chart/kube-flannel/templates/namespace.yaml deleted file mode 100644 index 81e7faeed9..0000000000 --- a/chart/kube-flannel/templates/namespace.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Namespace -apiVersion: v1 -metadata: - name: kube-flannel - labels: - pod-security.kubernetes.io/enforce: privileged diff --git a/chart/kube-flannel/templates/rbac.yaml b/chart/kube-flannel/templates/rbac.yaml index 5fdf3372bf..d08b37fcc5 100644 --- a/chart/kube-flannel/templates/rbac.yaml +++ b/chart/kube-flannel/templates/rbac.yaml @@ -42,4 +42,4 @@ roleRef: subjects: - kind: ServiceAccount name: flannel - namespace: kube-flannel + namespace: {{ .Release.Namespace }} diff --git a/chart/kube-flannel/templates/serviceaccount.yaml b/chart/kube-flannel/templates/serviceaccount.yaml index 186e59c691..c37316af1a 100644 --- a/chart/kube-flannel/templates/serviceaccount.yaml +++ b/chart/kube-flannel/templates/serviceaccount.yaml @@ -2,4 +2,4 @@ apiVersion: v1 kind: ServiceAccount metadata: name: flannel - namespace: kube-flannel + namespace: {{ .Release.Namespace }} diff --git a/chart/kube-flannel/tests/daemonset_test.yaml b/chart/kube-flannel/tests/daemonset_test.yaml new file mode 100644 index 0000000000..561e8f9cae --- /dev/null +++ b/chart/kube-flannel/tests/daemonset_test.yaml @@ -0,0 +1,47 @@ +suite: test daemonset +templates: + - daemonset.yaml +tests: + - it: should have the correct api version + asserts: + - isKind: + of: DaemonSet + - isAPIVersion: + of: apps/v1 + - equal: + path: metadata.name + value: kube-flannel-ds + + - it: should have the correct image + set: + flannel.image.repository: cicker.io/flannel/flannel + flannel.image.tag: v555.44.3 + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: cicker.io/flannel/flannel:v555.44.3 + - equal: + path: spec.template.spec.initContainers[1].image + value: cicker.io/flannel/flannel:v555.44.3 + + - it: should have the correct cni image + set: + flannel.image_cni.repository: cicker.io/flannel/flannel-cni-plugin + flannel.image_cni.tag: v777.66.5 + asserts: + - equal: + path: spec.template.spec.initContainers[0].image + value: cicker.io/flannel/flannel-cni-plugin:v777.66.5 + + - it: should have the correct args + set: + flannel.args: + - "--ip-masq" + - "--kube-subnet-mgr" + asserts: + - equal: + path: spec.template.spec.containers[0].command + value: + - "/opt/bin/flanneld" + - "--ip-masq" + - "--kube-subnet-mgr"