Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cilium: a firewall 🔥 to secure them all

Cilium: a firewall 🔥 to secure them all

Kubernetes is cool. You can have a lot of different services in various technologies. How to secure an REST API, gRPC communications between pods or a kafka queue with a single tool ?

Cilium is a networking driver used to secure a kubernetes cluster. It handles component communications on many layers (L3, L4, L7) providing load-balancing, filtering, ... It operates at kernel level to give blazing fast processing.

During our talk, we will introduce kubernetes networking concepts and ways to secure it. We will then demo the Cilium project and introduce eBPF concepts. We will finally give you our feedback on the project.

Pierre-Yves Aillet

June 04, 2019
Tweet

More Decks by Pierre-Yves Aillet

Other Decks in Technology

Transcript

  1. Standards & Craftsmanship Cilium: one firewall to secure them all

    Pierre-Yves Aillet @pyaillet Eric Briand @eric_briand
  2. #ContainerDayFR 2 Eric Briand Dev’ touche à tout à Zenika

    Nantes Organisateur du CNCF Meetup Nantes @eric_briand @ebriand Pierre-Yves Aillet Consultant formateur à Zenika Nantes @pyaillet @pyaillet
  3. Network policy #ContainerDayFR kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: namespace: webapp

    name: only-backend spec: podSelector: matchLabels: role: db ingress: - from: - podSelector: matchLabels: role: backend Type de la ressource Méta-données Informations habituelles de toutes les ressources Kubernetes
  4. Network policy #ContainerDayFR kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: namespace: webapp

    name: only-backend spec: podSelector: matchLabels: role: db ingress: - from: - podSelector: matchLabels: role: backend Les pods ayant le label “db” À partir du moment où le(s) Pod(s) correspond à une règle : - Le traffic est bloqué par défaut
  5. Network policy #ContainerDayFR kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: namespace: webapp

    name: only-backend spec: podSelector: matchLabels: role: db ingress: - from: - podSelector: matchLabels: role: backend Sens du traffic Source du traffic Seul le traffic explicitement autorisé est passant
  6. Architecture de notre SI avec network policy #ContainerDayFR events internal

    api kafka kafka zookeeper internal-frontend api events-frontend
  7. Cilium #ContainerDayFR • https://github.com/cilium/cilium • Go + C pour la

    partie eBPF • Version 1.5 • Network addon Kubernetes • Sécurisation à différents niveaux • S’intègre avec Istio, Docker, Mesos
  8. Cilium network policies apiVersion: [...] spec: endpointSelector: matchLabels: app: heroes-api

    ingress: - fromEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: internal toPorts: - ports: - port: "80" protocol: TCP rules: http: - method: "GET" path: "/heroes/?.*" • Structure similaire aux networks policies natives • Labels spécifiques Cilium/Kubernetes • Règles spécifiques au protocole L7
  9. Architecture de notre SI v2 #ContainerDayFR events internal api kafka

    kafka zookeeper internal-frontend api events-frontend
  10. Ok, mais en vrai il se passe quoi ? #ContainerDayFR

    Endpoint TC @ Endpoint bpf_lxc TC @ Endpoint bpf_netdev Endpoint L7 Policy Userspace Proxy Envoy
  11. C’était cool ? #ContainerDayFR • Installation avec l’operator simple mais

    architecture complexe • Le tooling pratique (ex : cilium policy trace) mais pas à tous les niveaux ! • Utilisation et syntaxe simples
  12. Suppression kube-proxy #ContainerDayFR Rôle de kube-proxy: - ClusterIP - NodePort

    Aujourd’hui Cilium: ClusterIP - Demain: ClusterIP + NodePort et au revoir kube-proxy
  13. Conclusion #ContainerDayFR • Projet prometteur ◦ Network policies++ ◦ Remplacement

    de kube-proxy • Usage intéressant de eBPF ◦ Lien userspace/kernel par les maps ◦ Affectation d’une identité k8s/docker/… aux src et dst des paquets
  14. Code & Références #ContainerDayFR Sources : • https://github.com/ebriand/conf-cilium Références :

    • https://cilium.io/ • http://www.brendangregg.com/ebpf.html • https://jvns.ca/blog/2017/06/28/notes-on-bpf---ebpf/ • https://www.youtube.com/watch?v=_Iq1xxNZOAo • https://cilium.io/blog/2018/12/03/cni-performance • https://itnext.io/benchmark-results-of-kubernetes-network-plugins-cni-ov er-10gbit-s-network-updated-april-2019-4a9886efe9c4