Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/max-lobur/k8s-weave-demo
A demo of pods isolation via NetworkPolicy on Weave CNI backend
https://github.com/max-lobur/k8s-weave-demo
kubernetes weave weaveworks
Last synced: 21 days ago
JSON representation
A demo of pods isolation via NetworkPolicy on Weave CNI backend
- Host: GitHub
- URL: https://github.com/max-lobur/k8s-weave-demo
- Owner: max-lobur
- License: mit
- Created: 2017-04-20T20:58:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-24T20:18:11.000Z (over 7 years ago)
- Last Synced: 2024-10-07T02:01:19.539Z (about 1 month ago)
- Topics: kubernetes, weave, weaveworks
- Language: Shell
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Inputs
1. Create a Kubernetes cluster
2. Use Weave to setup networking
3. Add three hosts:
* Logger
* API
* DB4. Use Weave to setup the following network rules:
* API → Logger UDP port 514
* API → DB TCP port 5432
* DB → Logger UDP port 5145. Visualize this in a network diagram
6. Add a script to prove that each machine can *only* connect to the machine(s) specified in the network rules above# Solution
### Cluster setup
* Get source: `git clone https://github.com/max-lobur/k8s-weave-demo.git && cd k8s-weave-demo`
* Get at least 2 CentOS boxes (4 Gb RAM, 2 CPU). Make sure hostnames are unique.
* Setup master:
```
ssh root@master 'bash -s' < cluster/k8s-centos.sh
ssh root@master 'bash -s' < cluster/master.sh
```
* Setup node(s):
```
ssh root@node 'bash -s' < cluster/k8s-centos.sh
ssh root@node
```
* To interact with the cluster we will be using kubectl on the master node, thus source must be copied on master as well: ` rsync -av . root@master:k8s-weave-demo`
* SSH to master:
```
ssh root@master
cd k8s-weave-demo
```
### App setup
* Deploy an app:
```
kubectl create -f app
watch kubectl -n net-policy-test get po -owide
```
* Run tests: `./run-tests.sh`
* Delete an app: `kubectl delete ns net-policy-test`### Network schema
![net diag.](net-diag.png)