SlideShare a Scribd company logo
K8Guard
An Auditing System For Kubernetes
Medya Ghazizadeh
Linux Foundation ONS March 26 - 29, 2018
Los Angeles, California
About Me
Apache V2 Legal and Disclaimers !
Can: Commercial Use, Modify, Distribute, Sublicense, Private Use, Use Patent
Claims, Place Warranty.
Can NOT: Hold Liable, Use Trademark
Must: Include Copyright, Include License, State Changes, Include Notice.
K8Guard was built in the same retail store that
makes this
The Name K8Guard
Pre-K8S Journey
● Migrated from run time configuration (Chef) to Netflix’s Immutable Pattern.
○ Convert chef cookbooks to RPMs
○ Prevent run time errors
● Use Spinnaker to deploy everywhere
● Canary Deployments and Chaos Monkey-ed everything.
● Promote 12 Factor App Design.
Three Things About K8S
Kubernetes is like the best tetris player
for your infrastructure
The Shiny Problem
definition
Shiny Problem 1: * in Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test
spec:
rules:
- host: *
http:
paths:
- path: /foo
backend:
serviceName: s1
servicePort: 80
Shiny Problem 2: 15 GB Image size
Why is that a problem?
How to avoid big image sizes?
Shiny Problem 3: Using Externally hosted images
- Deployment failed image failed to pull from docker hub
- Malicious code in Un-Scannable images
Shiny Problem 4: Root/Privileged Containers
Shiny Problem 5: Mount a HostPath volume
“hostPath”: A hostPath volume mounts a file or directory from the kubernete’s
host node’s filesystem into your pod. This is not something that most Pods will
need, but it offers a powerful escape hatch for some very very rare applications.
Shiny Problem 6: Single Replica
I admit this is the most controversial one !
Some people just don't need failover.
K8S Clusters
Problem Before
Facing Black
Friday
Efficiency
Security
Stability
Availability
A Kubernetes Prepared for Black Friday !
Keep The Lights On Even in Disaster !
Solution
Inspired By
The-Twelve-Factor
I. Codebase II. Dependencies III. Config IV. Backing
services V. Build, release, run VI. Stateless Processes VII.
Port binding VIII. Concurrency IX. Disposability X. Dev/prod
parity XI. Logs XII. Admin processes
Solution 1 - WRONG !
Wake up when with a pager’s alert and figure out
why k8s cluster is slow or down in the middle of
the night.
Set up 1-1 meeting with app teams, preach for
them the twelve factor app design and best
practices. Sending long email explaining back
and forth to each app team’s which does a
mistake.
Solution 2 - Scan/Action/Report Automatically
An Automated way to keep the K8S clusters form violations.
- Detect developer’s violations,
- Notify and warn them of their violation
- Take action on them on the violations
- Generate Metrics and Searchable reports for audits.
First Lets Defining Violation Types
Image Size Efficiency 5 GB image size
Image Repo Security Downloading
image from a shady repo
Extra Capabilities Security Setting UID/GUID
Privileged Mode Security Root containers
Single Replica Availability Not 12-factor app
Invalid Ingress Security/Stability Having "*” in ingress
Mount Host Vols Security/Stability Mounting kubernetes system files
No Owner Security No owner
annotation for namespace
Required Entity Security/Stability Required pod not deployed
Required Annotation Security/Stability Required annotation for
Enforce your policy on K8S entities
1. Deployments,
2. Pods
3. Jobs/CronJobs
4. Daemonset
5. Ingresses
6. Namespaces
K8Guard - An Auditing System For Kubernetes
K8Guard Discover
● Discover service, when in messaging mode, finds violations and puts them on a kafka topic.
and also discover API mode, is able to serve without depending on kafka. you can hit the end
points to get JSON response.
K8Guard Action
WHAT KIND OF ACTIONS DOES IT TAKE?
● Notifies the namespace owner (email, hipchat, …).
● After X amount of notifications, it will do a hard action such as:
○ Scale bad deployments down to zero.
○ Suspend bad jobs.
○ Delete bad ingress
Note that there is a safe mode - which only notifies and does not do hard actions.
Nasty Email
K8Guard Report
Report service will generate a human readable and searchable report of all the past violation
actions.
/metrics
Discover API generates 19 metrics which are accessible at /metrics, and you can hook a monitoring
system like Prometheus to collect them and then generate pretty Grafana dashboards.
Violation metric examples:
● The number of all deployments.
● The number of bad deployments.
● The number of all pods.
● The number of bad pods.
Performance metrics examples:
● The number of seconds took to return all images from Kubernetes api.
● The number of seconds took to return all deployments from Kubernetes api.
Example Grafana Dashboard
Why Golang?
- Statically linked libraries
- Ship Binary, and run it on Docker Scratch !
- Small language, New libraries,
- Strongly encourages good practices (error handling, formatting, ...)
- Kuberentes is written in Go itself.
Batteries Included !
Developer Friendly !
How many times you tried to run
a github project and built failed ?
Some projects not only don’t give
you the batteries, they won’t
even give you an idea what kind
of batteries you have to buy.
Just push the code and good
luck !
Makefile !
make help
make build-deploy-minikube
Open Sourcing K8S
Target embraces open source.
second open source project at Target. After
winnaker
«Только все знают всё»
Thank You Open source Contributions
- Daemonsets
- HelmCharts
- Bug fixes
- Reddis and minimal technoogy stack
Open Sourcing Challenges !
There are no bad pull requests! There are only a
bad merges !
Future of
K8Guard
- Engine Rule.
- Plugin System.
- Cloud Messaging.
- Delegate notification
- Consolidate
Technology Stack
Keep in touch, Make your first PR!
● https://github.com/k8guard
● https://k8guard.github.io
● Twitter: @medyadaily

More Related Content

What's hot (20)

PDF
DevOps Spain 2019. Beatriz Martínez-IBM
atSistemas
 
PDF
Gitops: a new paradigm for software defined operations
Mariano Cunietti
 
PPTX
GitOps - Modern best practices for high velocity app dev using cloud native t...
Weaveworks
 
PDF
10 Steps to Cloud Happiness
All Things Open
 
PDF
Image Scanning Best Practices for Containers and Kubernetes
DevOps.com
 
PDF
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
Daniel Bryant
 
PDF
You Want to Kubernetes? You MUST Know Containers!
VMware Tanzu
 
PDF
5 Kubernetes Security Tools You Should Use
DevOps.com
 
PDF
Running a Cost-Effective DynamoDB-Compatible Database on Managed Kubernetes S...
DevOps.com
 
PDF
Continuous Lifecycle London 2018 Event Keynote
Weaveworks
 
PDF
Kubernetes für Workstations Edge und IoT Devices
QAware GmbH
 
PDF
GitOps A/B testing with Istio and Helm
Weaveworks
 
PDF
Next Generation Vulnerability Assessment Using Datadog and Snyk
DevOps.com
 
PDF
Red Hat multi-cluster management & what's new in OpenShift
Kangaroot
 
PDF
Git in the Enterprise: How to succeed at DevOps using Git and a monorepo
Gina Bustos
 
PPTX
Deploy multi-environment application with Azure DevOps
Andrea Tosato
 
PDF
DevOps Spain 2019. David Cañadillas -Cloudbees
atSistemas
 
PDF
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 
PDF
Go for Operations
QAware GmbH
 
PDF
Hands-on GitOps Patterns for Helm Users
Weaveworks
 
DevOps Spain 2019. Beatriz Martínez-IBM
atSistemas
 
Gitops: a new paradigm for software defined operations
Mariano Cunietti
 
GitOps - Modern best practices for high velocity app dev using cloud native t...
Weaveworks
 
10 Steps to Cloud Happiness
All Things Open
 
Image Scanning Best Practices for Containers and Kubernetes
DevOps.com
 
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
Daniel Bryant
 
You Want to Kubernetes? You MUST Know Containers!
VMware Tanzu
 
5 Kubernetes Security Tools You Should Use
DevOps.com
 
Running a Cost-Effective DynamoDB-Compatible Database on Managed Kubernetes S...
DevOps.com
 
Continuous Lifecycle London 2018 Event Keynote
Weaveworks
 
Kubernetes für Workstations Edge und IoT Devices
QAware GmbH
 
GitOps A/B testing with Istio and Helm
Weaveworks
 
Next Generation Vulnerability Assessment Using Datadog and Snyk
DevOps.com
 
Red Hat multi-cluster management & what's new in OpenShift
Kangaroot
 
Git in the Enterprise: How to succeed at DevOps using Git and a monorepo
Gina Bustos
 
Deploy multi-environment application with Azure DevOps
Andrea Tosato
 
DevOps Spain 2019. David Cañadillas -Cloudbees
atSistemas
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 
Go for Operations
QAware GmbH
 
Hands-on GitOps Patterns for Helm Users
Weaveworks
 

Similar to K8Guard - An Auditing System For Kubernetes (20)

PDF
Continuous Security for GitOps
Weaveworks
 
PPTX
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
PDF
OSMC 2022 | Current State of icinga by Bernd Erk
NETWAYS
 
PDF
How to Secure Your Kubernetes Software Supply Chain at Scale
Anchore
 
PDF
vinay-mittal-new
Vinay Mittal
 
PDF
Where should I run my code? Serverless, Containers, Virtual Machines and more
Bret McGowen - NYC Google Developer Advocate
 
PDF
AZ-400 Exam Dumps Online – Proven by Learners Worldwide
lemoncuc92
 
PDF
Monitoring Your AWS EKS Environment with Datadog
DevOps.com
 
PPTX
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
Oleg Shalygin
 
PPTX
10 tips for Cloud Native Security
Karthik Gaekwad
 
PDF
GCP Meetup #3 - Approaches to Cloud Native Architectures
nine
 
PDF
Enabling NFV features in kubernetes
Kuralamudhan Ramakrishnan
 
PDF
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
sparkfabrik
 
PPTX
Ship code like a keptn
Rob Jahn
 
PDF
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Applitools
 
PDF
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
PDF
Slide DevSecOps Microservices
Hendri Karisma
 
PDF
Shift Right Security for EKS Webinar Slides
Anchore
 
PDF
Kubernetes and real-time analytics - how to connect these two worlds with Apa...
GetInData
 
PDF
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
Continuous Security for GitOps
Weaveworks
 
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
OSMC 2022 | Current State of icinga by Bernd Erk
NETWAYS
 
How to Secure Your Kubernetes Software Supply Chain at Scale
Anchore
 
vinay-mittal-new
Vinay Mittal
 
Where should I run my code? Serverless, Containers, Virtual Machines and more
Bret McGowen - NYC Google Developer Advocate
 
AZ-400 Exam Dumps Online – Proven by Learners Worldwide
lemoncuc92
 
Monitoring Your AWS EKS Environment with Datadog
DevOps.com
 
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
Oleg Shalygin
 
10 tips for Cloud Native Security
Karthik Gaekwad
 
GCP Meetup #3 - Approaches to Cloud Native Architectures
nine
 
Enabling NFV features in kubernetes
Kuralamudhan Ramakrishnan
 
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
sparkfabrik
 
Ship code like a keptn
Rob Jahn
 
Unlocking the Power of ChatGPT and AI in Testing - NextSteps, presented by Ap...
Applitools
 
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Slide DevSecOps Microservices
Hendri Karisma
 
Shift Right Security for EKS Webinar Slides
Anchore
 
Kubernetes and real-time analytics - how to connect these two worlds with Apa...
GetInData
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
Ad

Recently uploaded (20)

PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Ad

K8Guard - An Auditing System For Kubernetes

  • 1. K8Guard An Auditing System For Kubernetes Medya Ghazizadeh Linux Foundation ONS March 26 - 29, 2018 Los Angeles, California
  • 3. Apache V2 Legal and Disclaimers ! Can: Commercial Use, Modify, Distribute, Sublicense, Private Use, Use Patent Claims, Place Warranty. Can NOT: Hold Liable, Use Trademark Must: Include Copyright, Include License, State Changes, Include Notice.
  • 4. K8Guard was built in the same retail store that makes this
  • 6. Pre-K8S Journey ● Migrated from run time configuration (Chef) to Netflix’s Immutable Pattern. ○ Convert chef cookbooks to RPMs ○ Prevent run time errors ● Use Spinnaker to deploy everywhere ● Canary Deployments and Chaos Monkey-ed everything. ● Promote 12 Factor App Design.
  • 8. Kubernetes is like the best tetris player for your infrastructure
  • 10. Shiny Problem 1: * in Ingress apiVersion: extensions/v1beta1 kind: Ingress metadata: name: test spec: rules: - host: * http: paths: - path: /foo backend: serviceName: s1 servicePort: 80
  • 11. Shiny Problem 2: 15 GB Image size Why is that a problem? How to avoid big image sizes?
  • 12. Shiny Problem 3: Using Externally hosted images - Deployment failed image failed to pull from docker hub - Malicious code in Un-Scannable images
  • 13. Shiny Problem 4: Root/Privileged Containers
  • 14. Shiny Problem 5: Mount a HostPath volume “hostPath”: A hostPath volume mounts a file or directory from the kubernete’s host node’s filesystem into your pod. This is not something that most Pods will need, but it offers a powerful escape hatch for some very very rare applications.
  • 15. Shiny Problem 6: Single Replica I admit this is the most controversial one ! Some people just don't need failover.
  • 16. K8S Clusters Problem Before Facing Black Friday Efficiency Security Stability Availability
  • 17. A Kubernetes Prepared for Black Friday !
  • 18. Keep The Lights On Even in Disaster !
  • 20. I. Codebase II. Dependencies III. Config IV. Backing services V. Build, release, run VI. Stateless Processes VII. Port binding VIII. Concurrency IX. Disposability X. Dev/prod parity XI. Logs XII. Admin processes
  • 21. Solution 1 - WRONG ! Wake up when with a pager’s alert and figure out why k8s cluster is slow or down in the middle of the night. Set up 1-1 meeting with app teams, preach for them the twelve factor app design and best practices. Sending long email explaining back and forth to each app team’s which does a mistake.
  • 22. Solution 2 - Scan/Action/Report Automatically An Automated way to keep the K8S clusters form violations. - Detect developer’s violations, - Notify and warn them of their violation - Take action on them on the violations - Generate Metrics and Searchable reports for audits.
  • 23. First Lets Defining Violation Types Image Size Efficiency 5 GB image size Image Repo Security Downloading image from a shady repo Extra Capabilities Security Setting UID/GUID Privileged Mode Security Root containers Single Replica Availability Not 12-factor app Invalid Ingress Security/Stability Having "*” in ingress Mount Host Vols Security/Stability Mounting kubernetes system files No Owner Security No owner annotation for namespace Required Entity Security/Stability Required pod not deployed Required Annotation Security/Stability Required annotation for
  • 24. Enforce your policy on K8S entities 1. Deployments, 2. Pods 3. Jobs/CronJobs 4. Daemonset 5. Ingresses 6. Namespaces
  • 26. K8Guard Discover ● Discover service, when in messaging mode, finds violations and puts them on a kafka topic. and also discover API mode, is able to serve without depending on kafka. you can hit the end points to get JSON response.
  • 27. K8Guard Action WHAT KIND OF ACTIONS DOES IT TAKE? ● Notifies the namespace owner (email, hipchat, …). ● After X amount of notifications, it will do a hard action such as: ○ Scale bad deployments down to zero. ○ Suspend bad jobs. ○ Delete bad ingress Note that there is a safe mode - which only notifies and does not do hard actions.
  • 29. K8Guard Report Report service will generate a human readable and searchable report of all the past violation actions.
  • 30. /metrics Discover API generates 19 metrics which are accessible at /metrics, and you can hook a monitoring system like Prometheus to collect them and then generate pretty Grafana dashboards. Violation metric examples: ● The number of all deployments. ● The number of bad deployments. ● The number of all pods. ● The number of bad pods. Performance metrics examples: ● The number of seconds took to return all images from Kubernetes api. ● The number of seconds took to return all deployments from Kubernetes api.
  • 32. Why Golang? - Statically linked libraries - Ship Binary, and run it on Docker Scratch ! - Small language, New libraries, - Strongly encourages good practices (error handling, formatting, ...) - Kuberentes is written in Go itself.
  • 33. Batteries Included ! Developer Friendly ! How many times you tried to run a github project and built failed ? Some projects not only don’t give you the batteries, they won’t even give you an idea what kind of batteries you have to buy. Just push the code and good luck !
  • 34. Makefile ! make help make build-deploy-minikube
  • 35. Open Sourcing K8S Target embraces open source. second open source project at Target. After winnaker
  • 37. Thank You Open source Contributions - Daemonsets - HelmCharts - Bug fixes - Reddis and minimal technoogy stack
  • 38. Open Sourcing Challenges ! There are no bad pull requests! There are only a bad merges !
  • 39. Future of K8Guard - Engine Rule. - Plugin System. - Cloud Messaging. - Delegate notification - Consolidate Technology Stack
  • 40. Keep in touch, Make your first PR! ● https://github.com/k8guard ● https://k8guard.github.io ● Twitter: @medyadaily

Editor's Notes

  • #9: Matches the coming containers with best space for them.
  • #10: Some people who jump on the latest trendy shiny tool, miss out on the best practices.
  • #18: Large number of developers at Target, all excited to serve blackfriday traffic on K8S
  • #19: With all those problems we had, affecting 4 category, we needed to make sure will survive black friday’s traffic.
  • #26: Why 3 microservices ? the design was organic, we wanted separation of permissions and scopes of actions.