Skip to content

Commit 05b702a

Browse files
authored
[WIP] docs cleanup (#418)
* docs cleanup * fix unit test * index.md * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * docs * intro * Update index.md * docs * Update index.md * Update index.md * Update README.md
1 parent dfca917 commit 05b702a

File tree

9 files changed

+388
-674
lines changed

9 files changed

+388
-674
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ that has been thouroughly tested and optimized.
9595
## Getting Started
9696

9797
- [How it Works](./docs/how-it-works.md)
98-
- [Architecture](./docs/README.md#architecture)
99-
- [See Kube-router in action](./docs/README.md#see-kube-router-in-action)
100-
- [User Guide](./docs/README.md#user-guide)
98+
- [Architecture](./docs/architecture.md)
99+
- [See Kube-router in action](./docs/see-it-in-action.md)
100+
- [User Guide](./docs/user-guide.md)
101101
- [Developer Guide](./docs/developing.md)
102102

103103
## Project status

cmd/kube-router/kube-router_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ func TestMainHelp(t *testing.T) {
3232
stderrW.Close()
3333
wg.Wait()
3434

35-
docF, err := os.Open("../../docs/README.md")
35+
docF, err := os.Open("../../docs/user-guide.md")
3636
if err != nil {
37-
t.Fatalf("could not open docs/README.md: %s\n", err)
37+
t.Fatalf("could not open docs/user-guide.md: %s\n", err)
3838
}
3939
docBuf := bytes.NewBuffer(nil)
4040
docBuf.ReadFrom(docF)

docs/README.md

Lines changed: 2 additions & 332 deletions
Large diffs are not rendered by default.

docs/architecture.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Architecture
2+
3+
Kube-router is built around concept of watchers and controllers. Watchers use Kubernetes watch API to get notification on events related to create, update, delete of Kubernetes objects. Each watcher gets notification related to a particular API object. On receiving an event from API server, watcher broadcasts events. Controller registers to get event updates from the watchers and act up on the events.
4+
5+
Kube-router consists of 3 core controllers and multiple watchers as depicted in below diagram.
6+
7+
![Arch](./img/kube-router-arch.png)
8+
9+
Each of the [controller](https://github.com/cloudnativelabs/kube-router/tree/master/app/controllers) follows below structure
10+
11+
```
12+
func Run() {
13+
for {
14+
Sync() // control loop that runs for ever and perfom sync at periodic interval
15+
}
16+
}
17+
18+
func OnUpdate() {
19+
Sync() // on receiving update of a watched API object (namespace, node, pod, network policy etc)
20+
}
21+
22+
Sync() {
23+
//re-concile any state changes
24+
}
25+
26+
Cleanup() {
27+
// cleanup any changes (to iptables, ipvs, network etc) done to the system
28+
}
29+
```

docs/index.md

Lines changed: 23 additions & 335 deletions
Large diffs are not rendered by default.

docs/introduction.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Introduction
2+
3+
Welcome to the introduction guide to Kube-router! This guide is the best place to start with Kube-router. We cover what Kube-router is, what problems it can solve, how it compares to existing software, and how you can get started using it. If you are familiar with the basics of Kube-router, head over to the next sections that provide a more detailed reference of available features.
4+
5+
## What is Kube-router
6+
7+
If you are not familiar with Kubernetes networking model it is recommended to familiarize with Kubernetes [networking model](https://kubernetes.io/docs/concepts/cluster-administration/networking/#kubernetes-model). So essentially Kubernetes expects:
8+
9+
- all containers can communicate with all other containers without NAT
10+
- all nodes can communicate with all containers (and vice-versa) without NAT
11+
- the IP that a container sees itself as is the same IP that others see it as
12+
13+
Kubernetes only prescribes the requirements for the networking model but does not provide any default implementation. For a functional Kubernetes cluster one has to deploy what is called as CNI or pod networking solution that provides above functionality.
14+
15+
Any non-trivial containerized application will end up running multiple pods running different services. [Service](https://kubernetes.io/docs/concepts/services-networking/service/) abstraction in Kubernetes is an essential building block that helps in service discovery and load balancing. A layer-4 service proxy must be deployed to Kubernetes cluster that provides the load-balancing for the services exposed by the pods.
16+
17+
Once you have pod-to-pod networking established and have a service proxy that provides load-balancing, you need a way to secure your pods. Kubernetes [Network Policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) provides a specfication on how to secure pods. You need to deploy a solution that implements network policy specification and provides security to your pods.
18+
19+
Kube-router is a turnkey solution for Kubernetes networking that provides all the above essential functionality in one single elegant package.
20+
21+
## Why Kube-router
22+
23+
Network is hard. You have multiple Kubernetes networking solutions that provide pod networking or network policy etc. But when you deploy indiviudal solution for each functionality you end up with lot of moving parts making it difficult to operate and troubleshoot.
24+
25+
Kube-router is a lean yet powerful all-in-one alternative to several network components used in typical Kubernetes clusters. All this from a single DaemonSet/Binary. It doesn't get any easier.
26+
27+
Kube-router also uses best of the solution for maximum performance. Kube-router uses IPVS/LVS for service proxy and provides direct routing between the nodes.
28+
29+
Kube-router also provides very unique and advanced functionalities like DSR (Direct Server Return), ECMP based network load balancing etc

docs/see-it-in-action.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
1-
## See it in action
1+
# See Kube-router in action
22

3-
<a href="https://asciinema.org/a/118056" target="_blank"><img src="https://asciinema.org/a/118056.png" /></a>
3+
## Network Services Controller
44

5+
Network services controller is responsible for reading the services and endpoints information from Kubernetes API server and configure IPVS on each cluster node accordingly.
6+
7+
Please our read blog for design details and pros and cons compared to iptables based Kube-proxy
8+
https://cloudnativelabs.github.io/post/2017-05-10-kube-network-service-proxy/
9+
10+
Demo of Kube-router's IPVS based Kubernetes network service proxy
11+
12+
[![asciicast](https://asciinema.org/a/120312.png)](https://asciinema.org/a/120312)
13+
14+
Features:
15+
- round robin load balancing
16+
- client IP based session persistence
17+
- source IP is preserved if service controller is used in conjuction with network routes controller (kube-router with --run-router flag)
18+
- option to explicitly masquerade (SNAT) with --masquerade-all flag
19+
20+
## Network Policy Controller
21+
22+
Network policy controller is responsible for reading the namespace, network policy and pods information from Kubernetes API server and configure iptables accordingly to provide ingress filter to the pods.
23+
24+
Kube-router supports the networking.k8s.io/NetworkPolicy API or network policy V1/GA
25+
[semantics](https://github.com/kubernetes/kubernetes/pull/39164#issue-197243974) and also network policy beta semantics.
26+
27+
Please read blog for design details of Network Policy controller
28+
https://cloudnativelabs.github.io/post/2017-05-1-kube-network-policies/
29+
30+
Demo of Kube-router's iptables based implementaton of network policies
31+
32+
[![asciicast](https://asciinema.org/a/120735.png)](https://asciinema.org/a/120735)
33+
34+
## Network Routes Controller
35+
36+
Network routes controller is responsible for reading pod CIDR allocated by controller manager to the node, and advertises the routes to the rest of the nodes in the cluster (BGP peers). Use of BGP is transperent to user for basic pod-to-pod networking.
37+
38+
[![asciicast](https://asciinema.org/a/120885.png)](https://asciinema.org/a/120885)
39+
40+
However BGP can be leveraged to other use cases like advertising the cluster ip, routable pod ip etc. Only in such use-cases understanding of BGP and configuration is required. Please see below demo how kube-router advertises cluster IP and pod cidrs to external BGP router
41+
[![asciicast](https://asciinema.org/a/121635.png)](https://asciinema.org/a/121635)

docs/troubleshoot.md

Whitespace-only changes.

0 commit comments

Comments
 (0)