Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit edaadea

Browse files
author
Satya Ranjan Pradhan
committed
Version 3.0 release
1 parent 49b2953 commit edaadea

File tree

5 files changed

+389
-0
lines changed

5 files changed

+389
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Features covered in each CNI-Genie version:
2+
3+
## Existing features
4+
5+
**Feature 1: CNI-Genie "Multiple CNI Plugins"**
6+
* Interface Connector to 3rd party CNI-Plugins. The user can [manually select one of the multiple CNI plugins](multiple-cni-plugins/README.md)
7+
8+
**Feature 2: CNI-Genie "Multiple IP Addresses"**
9+
* Injects multiple IPs to a single container. The container is reachable using any of the [multiple IP Addresses](multiple-ips/README.md)
10+
11+
**Feature 3: CNI-Genie "Network Attachment Definition"**
12+
* [Network Attachment Definition](network-attachment-definitions/README.md) feature incorporates Kubernetes Network Custom Resource Definition De-facto Standard in CNI-Genie
13+
14+
**Feature 4: CNI-Genie "Smart CNI Plugin Selection"**
15+
* Intelligence in selecting the CNI plugin. CNI-Genie [watches the KPI of interest and selects](smart-cni-genie/README.md) the CNI plugin, accordingly
16+
17+
**Feature 5: CNI-Genie "Default Plugin Selection"**
18+
* Support to set default plugin of user choice to be used for all the pods being created
19+
20+
**Feature 6: CNI-Genie "Network Isolation"**
21+
* Dedicated 'physical' network for a tenant
22+
* Isolated 'logical' networks for different tenants on a shared 'physical'network
23+
24+
## Future features
25+
26+
**Feature 7: CNI-Genie "Network Policy Engine"**
27+
* [CNI-Genie network policy engine](network-policy/README.md) allows for network level ACLs
28+
29+
**Feature 8: CNI-Genie "Real-time Network Switching"**
30+
* Price minimization: dynamically switching workload to a cheaper network as network prices change
31+
* Maximizing network utilization: dynamically switching workload to the less congested network at a threshold
32+

releases/v3.0/GettingStarted.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Getting started
2+
3+
### Prerequisite
4+
5+
* Linux box with
6+
* We tested on Ubuntu 14.04 & 16.04
7+
* Docker installed
8+
* Kubernetes cluster running with CNI enabled
9+
* One easy way to bring up a cluster is to use [kubeadm](https://kubernetes.io/docs/getting-started-guides/kubeadm/):
10+
* We tested on Kubernetes 1.5, 1.6, 1.7, 1.8
11+
12+
Till 1.7 version:
13+
```
14+
$ kubeadm init --use-kubernetes-version=v1.7.0 --pod-network-cidr=10.244.0.0/16
15+
```
16+
17+
Version 1.8 onwards:
18+
```
19+
$ kubeadm init --pod-network-cidr=10.244.0.0/16
20+
```
21+
22+
Next steps:
23+
```
24+
$ mkdir -p $HOME/.kube
25+
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
26+
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
27+
```
28+
* To schedule pods on the master, e.g. for a single-machine Kubernetes cluster,
29+
30+
Till 1.7 version, run:
31+
```
32+
$ kubectl taint nodes --all dedicated-
33+
```
34+
35+
Version 1.8 onwards, run:
36+
```
37+
$ kubectl taint nodes --all node-role.kubernetes.io/master-
38+
```
39+
40+
41+
* One (or more) CNI plugin(s) installed, e.g., Calico, Weave, Flannel
42+
* Use this [link](https://docs.projectcalico.org/v3.2/getting-started/kubernetes) to install Calico
43+
* Use this [link](https://www.weave.works/docs/net/latest/kube-addon/) to install Weave
44+
* Use this [link](https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml) to install Flannel
45+
46+
### Installing genie
47+
48+
We install genie as a Docker Container on every node
49+
50+
Till Kubernetes 1.7 version:
51+
```
52+
$ kubectl apply -f https://raw.githubusercontent.com/Huawei-PaaS/CNI-Genie/master/conf/1.5/genie.yaml
53+
```
54+
55+
Kubernetes 1.8 version onwards:
56+
```
57+
$ kubectl apply -f https://raw.githubusercontent.com/Huawei-PaaS/CNI-Genie/master/releases/v3.0/genie.yaml
58+
```
59+
60+
### Building, Testing, Making changes to source code
61+
62+
Refer to our [Developer's Guide](developer-guide.md) section.
63+
64+
### Genie Logs
65+
66+
For now Genie logs are stored in /var/log/syslog
67+
To see the logs:
68+
```
69+
$ cat /dev/null > /var/log/syslog
70+
71+
$ tail -f /var/log/syslog | grep 'CNI'
72+
```
73+
74+
### Troubleshooting
75+
76+
* Note: one a single node cluster, after your Kubernetes master is initialized successfully, make sure you are able to schedule pods on the master by running:
77+
```
78+
$ kubectl taint nodes --all node-role.kubernetes.io/master-
79+
```
80+
* Note: most plugins use differenet installation files for Kuberenetes 1.5, 1.6, 1.7 & 1.8. Make sure you use the right one!

releases/v3.0/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# CNI-Genie
2+
3+
CNI-Genie enables container orchestrators ([Kubernetes](https://github.com/kubernetes/kubernetes), [Mesos](https://mesosphere.com/)) to seamlessly connect to the choice of CNI plugins installed on a host, including
4+
1. ['reference' CNI plugins](https://github.com/containernetworking/plugins), e.g., bridge, macvlan, ipvlan, loopback
5+
2. '3rd-party' CNI plugins, e.g., ([Calico](https://github.com/projectcalico/calico), [Romana](https://github.com/romana/romana), [Weave-net](https://github.com/weaveworks/weave))
6+
3. 'specialized' CNI plugins, e.g., [SR-IOV](https://github.com/hustcat/sriov-cni), DPDK (work-in-progress)
7+
4. any generic CNI plugin of choice installed on the host
8+
9+
Without CNI-Genie, the orchestrator is bound to only a single CNI plugin. E.g., for the case of Kubernetes, without CNI-Genie, kubelet is bound to only a single CNI plugin passed to kubelet on start. CNI-Genie allows for the co-existance of multiple CNI plugins in runtime.
10+
11+
[![Build Status](https://travis-ci.org/Huawei-PaaS/CNI-Genie.svg)](https://travis-ci.org/Huawei-PaaS/CNI-Genie)
12+
[![Go Report Card](https://goreportcard.com/badge/github.com/Huawei-PaaS/CNI-Genie)](https://goreportcard.com/report/github.com/Huawei-PaaS/CNI-Genie)
13+
14+
Please feel free to post your feedback, questions on CNI-Genie [Slack channel](https://cni-genie.slack.com/)
15+
16+
## Demo
17+
Here is a 6 minute demo video that demonstrates 3 scenarios
18+
1. Assign an IP address to a pod from a particular network solution, e.g., 'Weave-net'
19+
2. Assign multi-IP addresses to a pod from multiple network solutions, e.g., 1st IP address from 'Weave-net', 2nd IP address from 'Canal'
20+
3. Assign an IP address to a pod from the "less congested" network solution, e.g., from 'Canal' that is less congested
21+
22+
[![asciicast](https://asciinema.org/a/118191.png)](https://asciinema.org/a/118191)
23+
24+
# Contributing
25+
[Contributing](../../CONTRIBUTING.md)
26+
27+
[Code of Conduct](../../CODE_OF_CONDUCT.md)
28+
29+
# Why we created CNI-Genie?
30+
31+
CNI Genie is an add-on to [Kuberenets](https://github.com/kubernetes/kubernetes) open-source project and is designed to provide the following features:
32+
33+
1. [wide range of network offerings, CNI plugins](../../docs/multiple-cni-plugins/README.md), available to the users in runtime. This figure shows Kubernetes CNI Plugin landscape before and after CNI-Genie
34+
![image](../../docs/multiple-cni-plugins/what-cni-genie.png)
35+
- User-story: based on "performance" requirements, "application" requirements, “workload placement” requirements, the user could be interested to use different CNI plugins for different application groups
36+
- Different CNI plugins are different in terms of need for port-mapping, NAT, tunneling, interrupting host ports/interfaces
37+
38+
[Watch multiple CNI plugins demo](https://github.com/Huawei-PaaS/CNI-Genie/blob/master/docs/multiple-cni-plugins/README.md#demo)
39+
40+
41+
2. [Multiple NICs per container & per pod](../../docs/multiple-ips/README.md). The user can select multiple NICs to be added to a container upon creating them. Each NIC can get an IP address from an existing CNI plugin of choice. This makes the container reachable across multiple networks. Some use-cases from [SIG-Network](https://github.com/kubernetes/community/wiki/SIG-Network) are depicted in the figure below
42+
![image](../../docs/multiple-ips/multi-interface.PNG)
43+
44+
[Watch multi-NICs per 'container' demo](https://github.com/Huawei-PaaS/CNI-Genie/blob/master/docs/multiple-ips/README.md#demo)
45+
46+
[Watch multi-NICs per 'pod' demo](https://github.com/Huawei-PaaS/CNI-Genie/blob/master/docs/multiple-ips/README.md#feature-2-extension-cni-genie-multiple-ip-addresses-per-pod) (IP addresses assigned not only to the container, but also to the Pod)
47+
48+
3. [Network Attachment Definition](../../docs/network-attachment-definitions/README.md). CNI-Genie supports [NPWG Multi-Network Specification v1](https://github.com/K8sNetworkPlumbingWG/multi-net-spec) style network attachment to pods, where pods can be assigned IP according to network-attachment-definition CRD objects created by user.
49+
50+
4. The user can leave the CNI plugin selection to CNI-Genie. CNI-Genie watches the Key Performance Indicator (KPI) that is of interest to the user and [selects the CNI plugin](../../docs/smart-cni-genie/README.md), accordingly.
51+
- CNI Genie watches KPI(s) of interest for existing CNI plugins, e.g., occupancy rate, number of subnets, latency, bandwidth
52+
53+
[Watch Smart CNI Plugin Selection demo](https://github.com/Huawei-PaaS/CNI-Genie/blob/master/docs/smart-cni-genie/README.md#demo)
54+
55+
56+
5. [Default plugin support](../../docs/default-plugin/README.md). Another useful feature from genie. Using this, we can ensure to get ip address(es) for a pod by selecting default set of plugins
57+
58+
59+
6. Network isolation, i.e.,
60+
- Dedicated 'physical' network for a tenant
61+
- Isolated 'logical' networks for different tenants on a shared 'physical'network
62+
63+
Usecase : [Obtaining Pod Ip address from customized subnet](../../docs/network-isolation/README.md)
64+
65+
7. [CNI-Genie network policy engine](../../docs/network-policy/README.md) for network level ACLs
66+
67+
8. Real-time switching between different (physical or logical) networks for a given workload. This allows for
68+
- Price minimization: dynamically switching workload to a cheaper network as network prices change
69+
- Maximizing network utilization: dynamically switching workload to the less congested network at a threshold
70+
71+
![image](../../docs/network-switching.PNG)
72+
73+
Note: CNI-Genie itself is NOT a routing solution! It makes a call to CNI plugins that provide routing service
74+
75+
### More docs here [Getting started](GettingStarted.md), [CNI-Genie Feature Set](CNIGenieFeatureSet.md)
76+

releases/v3.0/developer-guide.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Developer's Guide
2+
3+
### Build process
4+
5+
After making any modification to source files, below steps can be followed to build and use the new binary.
6+
7+
Note that you should install genie first before making changes to the source. This ensures genie conf file is generated successfully.
8+
9+
Please make sure to run the below commands with root privilege.
10+
11+
#### *Building and Using CNI-Genie plugin:*
12+
13+
Build genie binary by running:
14+
```
15+
make plugin
16+
```
17+
Place "genie" binary from dest/ into /opt/cni/bin/ directory.
18+
```
19+
cp dist/genie /opt/cni/bin/genie
20+
```
21+
### Test process
22+
23+
#### prerequisites
24+
25+
A running kubernetes cluster is required to run the tests.
26+
27+
#### Running the tests
28+
29+
To run ginkgo tests for CNI-Genie run the following command:
30+
31+
If Kubernetes cluster is 1.7+
32+
```
33+
make test testKubeVersion=1.7 testKubeConfig=/etc/kubernetes/admin.conf
34+
```
35+
36+
If Kubernetes cluster is 1.5.x
37+
```
38+
make test testKubeVersion=1.5

releases/v3.0/genie.yaml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
kind: ClusterRole
3+
apiVersion: rbac.authorization.k8s.io/v1beta1
4+
metadata:
5+
name: genie
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- pods
11+
verbs:
12+
- get
13+
- update
14+
- patch
15+
- apiGroups:
16+
- "alpha.network.k8s.io"
17+
resources:
18+
- logicalnetworks
19+
verbs:
20+
- get
21+
- update
22+
- patch
23+
- apiGroups:
24+
- "alpha.network.k8s.io"
25+
resources:
26+
- physicalnetworks
27+
verbs:
28+
- get
29+
- update
30+
- patch
31+
- apiGroups:
32+
- "k8s.cni.cncf.io"
33+
resources:
34+
- network-attachment-definitions
35+
verbs:
36+
- get
37+
- update
38+
- apiGroups:
39+
- ""
40+
resources:
41+
- configmaps
42+
verbs:
43+
- get
44+
- apiGroups:
45+
- "admissionregistration.k8s.io"
46+
resources:
47+
- validatingwebhookconfigurations
48+
verbs:
49+
- get
50+
- update
51+
- create
52+
- delete
53+
54+
---
55+
kind: ClusterRoleBinding
56+
apiVersion: rbac.authorization.k8s.io/v1beta1
57+
metadata:
58+
name: genie
59+
roleRef:
60+
apiGroup: rbac.authorization.k8s.io
61+
kind: ClusterRole
62+
name: genie
63+
subjects:
64+
- kind: ServiceAccount
65+
name: genie
66+
namespace: kube-system
67+
- kind: Group
68+
name: system:authenticated
69+
apiGroup: rbac.authorization.k8s.io
70+
71+
---
72+
apiVersion: v1
73+
kind: ServiceAccount
74+
metadata:
75+
name: genie
76+
namespace: kube-system
77+
78+
---
79+
# This ConfigMap can be used to configure a self-hosted CNI-Genie installation.
80+
kind: ConfigMap
81+
apiVersion: v1
82+
metadata:
83+
name: genie-config
84+
namespace: kube-system
85+
data:
86+
# The CNI network configuration to install on each node.
87+
cni_genie_network_config: |-
88+
{
89+
"name": "k8s-pod-network",
90+
"type": "genie",
91+
"log_level": "info",
92+
"datastore_type": "kubernetes",
93+
"hostname": "__KUBERNETES_NODE_NAME__",
94+
"policy": {
95+
"type": "k8s",
96+
"k8s_auth_token": "__SERVICEACCOUNT_TOKEN__"
97+
},
98+
"kubernetes": {
99+
"k8s_api_root": "https://__KUBERNETES_SERVICE_HOST__:__KUBERNETES_SERVICE_PORT__",
100+
"kubeconfig": "/etc/cni/net.d/genie-kubeconfig"
101+
},
102+
"romana_root": "http://__ROMANA_SERVICE_HOST__:__ROMANA_SERVICE_PORT__",
103+
"segment_label_name": "romanaSegment"
104+
}
105+
---
106+
# Install CNI-Genie plugin on each slave node.
107+
kind: DaemonSet
108+
apiVersion: extensions/v1beta1
109+
metadata:
110+
name: genie-plugin
111+
namespace: kube-system
112+
labels:
113+
k8s-app: genie
114+
spec:
115+
selector:
116+
matchLabels:
117+
k8s-app: genie
118+
template:
119+
metadata:
120+
labels:
121+
k8s-app: genie
122+
annotations:
123+
scheduler.alpha.kubernetes.io/critical-pod: ''
124+
spec:
125+
hostNetwork: true
126+
hostPID: true
127+
serviceAccountName: genie
128+
tolerations:
129+
- key: CriticalAddonsOnly
130+
operator: Exists
131+
- key: node.kubernetes.io/not-ready
132+
effect: NoSchedule
133+
operator: Exists
134+
containers:
135+
# Create a container with install.sh that
136+
# Installs required 00-genie.conf and genie binary
137+
# on slave node.
138+
- name: install-cni
139+
image: cnigenie/genie-plugin:v3.0
140+
imagePullPolicy: Always
141+
command: ["/launch.sh"]
142+
env:
143+
- name: CNI_NETWORK_CONFIG
144+
valueFrom:
145+
configMapKeyRef:
146+
name: genie-config
147+
key: cni_genie_network_config
148+
- name: KUBERNETES_NODE_NAME
149+
valueFrom:
150+
fieldRef:
151+
fieldPath: spec.nodeName
152+
volumeMounts:
153+
- mountPath: /host/opt/cni/bin
154+
name: cni-bin-dir
155+
- mountPath: /host/etc/cni/net.d
156+
name: cni-net-dir
157+
volumes:
158+
- name: cni-bin-dir
159+
hostPath:
160+
path: /opt/cni/bin
161+
- name: cni-net-dir
162+
hostPath:
163+
path: /etc/cni/net.d

0 commit comments

Comments
 (0)