Skip to content

Commit

Permalink
Merge pull request #1741 from lexfrei/master
Browse files Browse the repository at this point in the history
Fix existing ns issue
  • Loading branch information
rbrtbnfgl authored Mar 22, 2023
2 parents 02617d5 + 87d16b2 commit f057792
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 21 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,28 @@ 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.

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
Expand All @@ -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)
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
2 changes: 2 additions & 0 deletions chart/kube-flannel/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/
.helmignore
2 changes: 1 addition & 1 deletion chart/kube-flannel/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: kube-flannel-cfg
namespace: kube-flannel
namespace: {{ .Release.Namespace }}
labels:
tier: node
app: flannel
Expand Down
2 changes: 1 addition & 1 deletion chart/kube-flannel/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions chart/kube-flannel/templates/namespace.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion chart/kube-flannel/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: flannel
namespace: kube-flannel
namespace: {{ .Release.Namespace }}
2 changes: 1 addition & 1 deletion chart/kube-flannel/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: flannel
namespace: kube-flannel
namespace: {{ .Release.Namespace }}
47 changes: 47 additions & 0 deletions chart/kube-flannel/tests/daemonset_test.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit f057792

Please sign in to comment.