37
Secure, Cloud-Native Networking Simple, scalable, secure networking for Kubernetes Shaun Crampton, Core Developer, Project Calico @projectcalico 10 th March 2016

KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Embed Size (px)

Citation preview

Page 1: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Secure, Cloud-Native NetworkingSimple, scalable, secure networking for KubernetesShaun Crampton, Core Developer, Project Calico @projectcalico

10th March 2016

Page 2: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 3: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 4: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

OperationalSimplicity

Page 5: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 6: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 7: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

Service

Router

Router

Router

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

Page 8: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

Service

Router

Router

Router

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

IP

Service

Container Host

Page 9: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Container Host

Container Namespace

Root Namespace

Container Namespace

eth0

eth0

192.

168.

0.45

10.0.0.1

eth010.0.0.2

IP

Linux Kernel Routing(you already have this!)default via 192.168.0.1 dev eth0 192.168.0.0/24 dev eth0 src 10.0.2.15 10.0.0.1/32 dev cali34 scope global10.0.0.2/32 dev cali89 scope global10.0.1.0/26 via 192.168.0.29 dev eth010.0.2.128/26 via 192.168.0.131 dev eth0

veth pair (kernel version 2.6.24+)

Containers on other hosts

Containers on this host

cali34

cali89

Page 10: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

OperationalSimplicity

Scalability

Page 11: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 12: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 13: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

OperationalSimplicity

Scalability Security

Page 14: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 15: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

FBI director James Comey has said he believes Sony’s cyberattackers first breached the studio’s network in September, gaining access through a common tactic called “spear phishing”—duping an employee into clicking on an email attachment or a web link.

…For more than two months Sony’s hackers roamed freely, identifying what they wanted to steal. This was possible because the studio, with few exceptions, didn’t segregate or provide extra security for even its most precious secrets. In effect, once the invaders made it past the network gates they could go anywhere they wanted because Sony hadn’t locked any doors.

Inside the Hack of the Century by Peter Elkind, Fortune.com

Page 16: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

© C

hris

van

Dyc

k ht

tps:

//ww

w.fl

ickr

.com

/pho

tos/

chris

vand

yck/

4453

0366

99

Page 17: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 18: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 19: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 20: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 21: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 22: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Developer intent

Page 23: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico
Page 24: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Container Host

Container Namespace

Root Namespace

Container Namespace

eth0

eth0

192.

168.

0.4510.0.0.1

eth010.0.0.2

IP

Linux Kernel Filtering (iptables)(you already have this!)

Per-container distributed firewall

cali34

cali89

Page 25: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

NetworkPolicy v1alpha1 DEMO:https://vimeo.com/159475864/

d54a4781d5

Page 26: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 27: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 28: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Turn on isolation…

kubectl annotate ns default \ "net.alpha.kubernetes.io/network-isolation=yes" \ --overwrite=truekubectl annotate ns client \ "net.alpha.kubernetes.io/network-isolation=yes" \ --overwrite=true

Page 29: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 30: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

admin-ui.yaml

kind: NetworkPolicyapiVersion: net.alpha.kubernetes.io/v1alpha1metadata: namespace: default name: allow-uispec: podSelector: ingress: - from: - namespaces: role: management-ui

Metadata

Empty selector applies to all pods

Allow from management namespace

Page 31: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 32: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

backend-policy.yamlkind: NetworkPolicyapiVersion: net.alpha.kubernetes.io/v1alpha1metadata: namespace: default name: backend-policyspec: podSelector: tier: backend ingress: - from: - pods: tier: frontend ports: - protocol: TCP port: 637

Allow from frontends on port 637 only

Apply to backends

Page 33: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 34: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

frontend-policy.yamlkind: NetworkPolicyapiVersion: net.alpha.kubernetes.io/v1alpha1metadata: namespace: default name: frontend-policyspec: podSelector: tier: frontend ingress: - from: - namespaces: role: client ports: - protocol: TCP port: 80

Apply to frontends

Allow from clientsOn port 80

Page 35: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Client NS Default NS Mgmt NSF

C

B

F

B

F

UI

Page 36: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

IP

OperationalSimplicity

Scalability Security

Page 37: KubeCon EU 2016: Secure, Cloud-Native Networking with Project Calico

Main project website: www.projectcalico.org

Production plugin: https://goo.gl/pyNsIf Try out the demo: https://goo.gl/

BYC97u Ansible playbooks from Kubespray

https://docs.kubespray.io/ Public #slack

https://calicousers-slackin.herokuapp.com/

Download & try it out We welcome your feedback and

contributions Follow me @fasaxc Follow us @projectcalico