Giter VIP home page Giter VIP logo

calico-playground's Introduction

calico-playground

Playing with Calico

Environment

I decided to use GKE, version 1.16.8-gke.8 because I can get a kubernete cluster after one click.

Install

Check install calicoctl version

Client Version:    v3.12.0
Git commit:        84a21b3b
Cluster Version:   v3.12.0
Cluster Type:      k8s,kdd,bgp
calicoctl get node -o wide
$ gke-cluster-1-default-pool-6ca3b7a6-nthv
$ ...

Then before applying calico rules, check if network policies are working: https://github.com/ahmetb/kubernetes-network-policy-recipes/blob/master/01-deny-all-traffic-to-an-application.md

Playground

3 apps:

  • nginx1
  • nginx2
  • debian1

Deploy nginx 1,2 + debian1:

kubeclt apply -f resources/

No Rule applied

  • No rule applied, everything can talk to each other.

Examples:

Nginx1 to Nginx2:

kubectl exec -it $(kubectl get pod -o name  | grep nginx-deployment-1) bash
$apt-get update && apt-get install -y curl
$curl my-service-2.default.svc.cluster.local
# Get html response form nginx

Only nginx rule applied

calicoctl apply -f calico-playground/network_policies/nginx-2-allow-ingress.yaml
root@nginx-deployment-1-b676f78df-66jqt:/# curl my-service-2.default.svc.cluster.local

Only pod 1 can talk to my-service-2, debian1 can not.

curl my-service-2.default.svc.cluster.local -> timeout

Debian1 can talk to wget my-service-1.default.svc.cluster.local

Global network rule only

Let's apply: deny-all-global-network-policy.yaml

calicoctl apply -f deny-all-global-network-policy.yaml
Pods in default namespace

No ingress traffic, egress traffic is impacted because I can't access kube-dns to resolve dns.

Pods in kube namespace

No ingress traffic, egress traffic is impacted because I can't access kube-dns to resolve dns.

Application layer policy

References

calico-playground's People

Contributors

emirot avatar

Stargazers

Christopher Zorn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.