SlideShare a Scribd company logo
Kubernetes Security
Karthik Gaekwad
INNOTECH Austin 2018
• I’m Karthik Gaekwad
• NOT a DBA
• https://cloudnative.oracle.com/
• Cloud Native evangelist at OCI
• Used to be a developer on the OKE Team.
Hello
@iteration1
Hello
• Been in Industry 15 years.
• In general, I like building stuff with friends.
• A maintainer for Gauntlt- Open source security scanner.
• Love Teaching and building community.
• Run Devopsdays Austin, Container Days, Cloud Austin.
• Chair All Day Devops Cloud Native track.
• LinkedIn Learning Author for Learning Kubernetes (and more).
Need an OCI Trial Account?
http://bitly.com/ocicloud
My questions for you..
The Cloud Native Journey
6
Phase I
Developer Focus
Phase II
DevOps Focus
Phase III
Business Focus
(end-to-end)
Container Adoption Application Deployment Intelligent Operations
SpeedEfficiencyAgility
Docker
Kubernetes
Core to Edge
Developer adoption
Dev/Test apps
Simple orchestration
Individual developers
DevOps deployment
Production apps
Advanced orchestration
Teams & lines of business
End-to-end integration
Digital business apps
Serverless, DevSecOps, & ML
Cloud native enterprises
Focus
Applications
Automation
Community
Latest CNCF Survey: August 2018
How Does Your Company Use Containers and Where?
Kubernetes Dominates Container Management
Your company/organization manages
containers with:
Good News, Bad News…
Good: On
average, CNCF
project usage is
up over 200%
since the Dec
2017!
But...
Complexity, Culture, Training, & Security Issues
Remain
• Managing, maintaining, upgrading Kubernetes Control
Plane
• API Server, etcd, scheduler etc….
• Managing, maintaining, upgrading Kubernetes Data
Plane
• In place upgrades, deploy parallel cluster etc….
• Figuring out container networking & storage
• Overlays, persistent storage etc… - it should just work
• Managing Teams
• How do I manage & control team access to my clusters?
• Security, security, security
Kubernetes & Cloud Native Challenges
11
Source: Oracle Customer Survey 2018
How Are Teams Addressing Complexity, Training Issues?
App Management
Upgrades & Patching
Platform Backup & Recovery
High Availability
Scaling
App Deployment
Power, HVAC
Rack and Stack
Server Provisioning
Software Installation
Customer Managed Fully-Managed
App Management
Upgrades & Patching
Platform Backup & Recovery
High Availability
Scaling
App Deployment
Power, HVAC
Rack and Stack
Server Provisioning
Software Installation
 Faster Time to Deploy
 Lower Risk
 Accelerate Innovation
Benefits
YOU
Which brings us to security…
Where no news, is good news!
Unsecured K8s dashboards
• Unsecured Kubernetes
Dashboard with account creds.
• Used this to mine
cryptocurrency.
• 2017: Aviva
• 2018: Tesla, Weight Watchers
• https://redlock.io/blog/cryptoja
cking-tesla
Kubelet credentials hack
• Shopify: Server Side request
Forgery
• Get kubelet certs/private key
• Root access to any container in
part of infrastructure.
• https://hackerone.com/reports/
341876
Kubernetes Security
Kubernetes Security
Kubernetes Security
Kubernetes Security
WAT?
How did we get here?
“Kubernetes is too complicated”
“Kubernetes is too complicated”
“We hope it’ll get easier”
What is your strate
Let’s look at:
•Attack Surface
• More importantly, how to limit damage
•Security related features in K8s
• The more you know, the better you build
•Opensource Tooling to help
• Because we all need help
Attack Surface
Attack Surface
Goal: Reduce the attack surface
•Analysis for:
•Host
•Container (Images and running)
•Kubernetes Cluster
Attack Surface
• Work on reducing the attack surface:
• Analysis for:
• Host
• Container (Images and running)
• Kubernetes Cluster
Attack Surface: Host
• These are the machines you’re running Kubernetes on.
• Age old principles of Linux still apply:
• Enable SELinux
• AppArmor
• Seccomp
• Goal: Minimize privilege to applications running on the host
Attack Surface: Container Images
• Know your base image when building containers
• Smaller the better
• Don’t rely on :latest tag
• Check for vulnerabilities periodically
Attack Surface: Running Containers
• Don’t run as root
• Limit host mounts
Attack Surface: Kubernetes Cluster
• TLS
• Audit Logs
• Network Policies
• Pod Security Policies
• Secrets
Kubernetes Cluster: TLS
TLS ALL THE THINGS
Attack Surface: Host
• These are the machines you’re running Kubernetes on.
• Age old principles of Linux still apply:
• Enable SELinux
• AppArmor
• Seccomp
• Hardened Images
• Goal: Minimize privilege to applications running on the host
• Good news: Already a wealth of information on this subject!
• http://lmgtfy.com/?q=how+to+reduce+attack+surface+linux
Attack Surface: Container Images
GOAL: Know your base image when
building containers
Attack Surface: Container Images
GOAL: Know your base image when building containers
**BTW, this is just a ruby helloworld app
Attack Surface: Container Images
GOAL: Know your base image when building containers
**BTW, this is just a ruby helloworld app
Attack Surface: Container Images
GOAL: Know your base image when building containers
Full disclosure: I’m karthequian; I created this as a ruby 101 container for learning purposes only
Attack Surface: Container Images
GOAL: Know your base image when building containers
• When in doubt, stick to an official images!
• Or start from a sane base image (example: alpine linux)
Attack Surface: Container Images
GOAL: Smaller the image, the better
• Less things for an attacker to exploit.
• Quicker to push, quicker to pull.
Attack Surface: Container Images
GOAL: Don’t rely on :latest tag
• :latest image yesterday might not be :latest image tomorrow
• Instead, you’d want to know what specific version you’re operating
with.
• Side benefit: If there is a new vulnerability announced for OS version
x.y.z, you know immediately whether you’re running that version!
Attack Surface: Container Images
GOAL: Check for vulnerabilities
periodically
• Plenty of ways to do this in registries. We’ll cover more in the tooling
section
Attack Surface: Running Containers
GOAL: Don’t run as root
• Containers running as root might be completely unnecessary for the
actual application.
• If compromised, attacker can do a lot more things..
• Pod security policies can help (we’ll see how later).
Attack Surface: Running Containers
GOAL: Limit host mounts
• Be wary of images that require broad access to paths on the host
• Limit your host mount to a smaller subset of directories
• Reduces blast radius on compromise
Attack Surface:
Kubernetes Cluster
Kubernetes Cluster- TLS
TLS ALL THE THINGS
Kubernetes Cluster- TLS
• TLS Checklist:
1. Nodes and Master
2. User and Master
3. Everything etcd
4. Kubelet to API
Server
Kubernetes Cluster- TLS
Kubernetes Cluster- TLS
• TLS Checklist:
1. User and Master
2. Nodes and Master
3. Everything etcd
4. Kubelet to API
Server
We’re a little
better off now.
But what else to do?
K8s Features
How can the platform help
me make secure choices?
K8s Features
• Authentication
• Authorization
• Audit Logging
• Network Policies
• Pod security policies
• Kubernetes Secrets
Authentication and Authorization
• Do you know how you are authenticating with Kubernetes?
• Many ways to Authenticate
• Client Certs
• Static token file
• Service Account tokens
• OpenID
• Webhook Mode
• And more (https://kubernetes.io/docs/reference/access-authn-authz/authentication/)
Whatever you do,
DO NOT YOLO!
Goal: Pick a strategy that fits
your use case
You can pick an authz strategy..
If you DO NOT YOLO…
Authentication and Authorization
https://kubernetes.io/docs/reference/access-authn-authz/authorization/
Authentication and Authorization
• Pro tip: Nobody uses ABAC anymore. Don’t be that guy….
• RBAC is the defacto standard
• Based on roles and role bindings
• Good set of defaults: https://github.com/uruddarraju/kubernetes-rbac-policies
• Can use multiple authorizers together, but can get confusing.
• 1st authorizer to authorize passes authz
Kubernetes Cluster- Audit Logs
• Wat?
• “Kubernetes auditing provides a security-relevant chronological set
of records documenting the sequence of activities that have affected
system by individual users, administrators or other components of
the system.”
• Answers: What/when/who/where information on security events.
• Your job: Periodically watch Kubernetes Audit logs
• https://kubernetes.io/docs/tasks/debug-application-cluster/audit/
Kubernetes Security
Kubernetes Cluster- Network Policies
• Consider adding a network policy to the cluster…
• Default Policy: All pods can talk to all other pods.
• Consider limiting this with a Network Policy
• https://kubernetes.io/docs/concepts/services-networking/network-policies/
Kubernetes Cluster- Pod Security Policies
• Consider adding Pod Security policies
• PodSecurityPolicy: A Defined set of conditions a pod must run with.
• Think of this as authorization for pods.
Kubernetes Cluster: Pod Security Policies
https://kubernetes.io/docs/concepts/policy/pod-security-policy/#what-is-a-pod-security-policy
Capability for
an admin to
control specific
actions
Kubernetes Secrets
• GOAL: Use Kubernetes secrets to store sensitive data instead of
config maps.
• Also look at: secrets encryption provider.
• Controls how etcd encrypts API data
• --experimental-encryption-provider-config
• https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/
ToolingOpensource Tooling
Keep tabs on the CNCF Security landscape
https://landscape.cncf.io/landscape=security-compliance
CNCF Projects
• “The Update Framework”
• Is a framework or a
methodology.
• Used for secure software
updates.
• Based on ideas surrounding
trust and integrity.
• Is a project.
• Based on TUF.
• A solution to secure software
updates and distribution.
• Used in Docker Trusted Registry.
Clair
• Open source project for the static analysis of vulnerabilities in
containers.
• Find vulnerable images in your repo.
• Built into quay.io, but you can add to your own repo.
• https://github.com/coreos/clair
Kubernetes Security
Kube-bench
• Checks whether a Kubernetes cluster is deployed according to
security best practices.
• Run this after creating your K8s cluster.
• https://github.com/aquasecurity/kube-bench
• Defined by the CIS Benchmarks Docs: https://www.cisecurity.org/cis-
benchmarks/
• Run it against your Kubernetes Master, or Kubernetes node.
Kube-bench example
Kubesec
• Helps you quantify risk for Kubernetes resources.
• Run against your K8s applications (deployments/pods/daemonsets
etc)
• https://kubesec.io/ from controlplane
• Can be used standalone, or as a kubectl plugin
(https://github.com/stefanprodan/kubectl-kubesec)
Kubesec example
Kubeaudit
• Opensourced from Shopify.
• Auditing your applications in your K8s cluster.
• https://github.com/Shopify/kubeaudit
• Little more targeted than Kubesec.
Kubernetes Security
Kubeaudit example
“So much time and so little to do.”
Couple more resources to look at:
• 11 ways not to get hacked:
https://kubernetes.io/blog/2018/07/18/11-ways-not-to-get-hacked
• K8s security (from Image Hygiene to Network Policy):
https://speakerdeck.com/mhausenblas/kubernetes-security-from-
image-hygiene-to-network-policies
KEEP CALM
AND
KUBE ON
@iteration1

More Related Content

PDF
Kubernetes security
PPTX
Kubernetes and container security
PDF
Kubernetes - Security Journey
PDF
Terraform
PPTX
Grafana.pptx
PDF
5G Security Briefing
PDF
Advanced: Private Networks & 5G Non-Public Networks
PPTX
Comprehensive Terraform Training
Kubernetes security
Kubernetes and container security
Kubernetes - Security Journey
Terraform
Grafana.pptx
5G Security Briefing
Advanced: Private Networks & 5G Non-Public Networks
Comprehensive Terraform Training

What's hot (20)

PDF
Getting Started with Kubernetes
PDF
Kubernetes Networking
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
PDF
Kubernetes 101
PDF
Kubernetes Basics
PPTX
K8s in 3h - Kubernetes Fundamentals Training
PDF
Open shift 4 infra deep dive
PPTX
Hashicorp Vault ppt
PPTX
Introduction to Docker - 2017
PDF
Introduction of Kubernetes - Trang Nguyen
PPTX
Kubernetes for Beginners: An Introductory Guide
PDF
Kubernetes
PDF
Hands-On Introduction to Kubernetes at LISA17
PDF
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
PPTX
Kubernetes PPT.pptx
PDF
Kubernetes architecture
PDF
Kubernetes - A Comprehensive Overview
PDF
Kubernetes: A Short Introduction (2019)
PDF
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
PPSX
Docker Kubernetes Istio
Getting Started with Kubernetes
Kubernetes Networking
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes 101
Kubernetes Basics
K8s in 3h - Kubernetes Fundamentals Training
Open shift 4 infra deep dive
Hashicorp Vault ppt
Introduction to Docker - 2017
Introduction of Kubernetes - Trang Nguyen
Kubernetes for Beginners: An Introductory Guide
Kubernetes
Hands-On Introduction to Kubernetes at LISA17
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
Kubernetes PPT.pptx
Kubernetes architecture
Kubernetes - A Comprehensive Overview
Kubernetes: A Short Introduction (2019)
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
Docker Kubernetes Istio
Ad

Similar to Kubernetes Security (20)

PPTX
10 tips for Cloud Native Security
PPTX
DevSecOps in a cloudnative world
PDF
Moving a Monolith to Kubernetes
PPTX
Simplify Your Way To Expert Kubernetes Management
PPTX
Database as a Service (DBaaS) on Kubernetes
PPTX
Why to Cloud Native
PPTX
Why kubernetes matters
PPTX
Kubernetes: від знайомства до використання у CI/CD
PDF
DCSF19 Container Security: Theory & Practice at Netflix
PPTX
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
PPTX
Kubernetes @ meetic
PPTX
Centralizing Kubernetes and Container Operations
PDF
Containers, microservices and serverless for realists
PPTX
Stop Caring About Kubernetes
PDF
Secure your K8s cluster from multi-layers
PPTX
DevOps Security: A New Paradigm
PDF
oci-container-engine-oke-100.pdf
PDF
KubeCon 2019 Recap (Parts 1-3)
PDF
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
PPTX
DockerCon 15 Keynote - Day 2
10 tips for Cloud Native Security
DevSecOps in a cloudnative world
Moving a Monolith to Kubernetes
Simplify Your Way To Expert Kubernetes Management
Database as a Service (DBaaS) on Kubernetes
Why to Cloud Native
Why kubernetes matters
Kubernetes: від знайомства до використання у CI/CD
DCSF19 Container Security: Theory & Practice at Netflix
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
Kubernetes @ meetic
Centralizing Kubernetes and Container Operations
Containers, microservices and serverless for realists
Stop Caring About Kubernetes
Secure your K8s cluster from multi-layers
DevOps Security: A New Paradigm
oci-container-engine-oke-100.pdf
KubeCon 2019 Recap (Parts 1-3)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
DockerCon 15 Keynote - Day 2
Ad

More from Karthik Gaekwad (20)

PDF
Mental Health studies and devops
PPTX
This is your community
PPTX
Practical Approaches to Cloud Native Security
PPTX
Kube Apps in action
PPTX
KubeSecOps
PDF
Kubernetes security and you
PPTX
Kube applications in action
PDF
Devops and Dadops
PDF
Containers and microservices for realists
PDF
13 practical tips for writing secure golang applications
PPTX
Why to docker
PDF
Docker management
PDF
Agile 2014- Metrics driven development and devops
PDF
Devopsdays Austin 2014 Ignite: Keep devops weird
PDF
Cloud Austin 2013: Conferenced2013
PDF
LASCON 2013 Talk: User Auth for Winners, how to get it right the first time!
PDF
Agile 2013 Talk: How DevOps Changes Everything
PDF
DevOps at the CIA
PDF
Sexy HTML with Twitter Bootstrap
PPTX
12 Clouds of Christmas 2012- Stormpath
Mental Health studies and devops
This is your community
Practical Approaches to Cloud Native Security
Kube Apps in action
KubeSecOps
Kubernetes security and you
Kube applications in action
Devops and Dadops
Containers and microservices for realists
13 practical tips for writing secure golang applications
Why to docker
Docker management
Agile 2014- Metrics driven development and devops
Devopsdays Austin 2014 Ignite: Keep devops weird
Cloud Austin 2013: Conferenced2013
LASCON 2013 Talk: User Auth for Winners, how to get it right the first time!
Agile 2013 Talk: How DevOps Changes Everything
DevOps at the CIA
Sexy HTML with Twitter Bootstrap
12 Clouds of Christmas 2012- Stormpath

Recently uploaded (20)

PPTX
A Presentation on Touch Screen Technology
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A novel scalable deep ensemble learning framework for big data classification...
A Presentation on Touch Screen Technology
cloud_computing_Infrastucture_as_cloud_p
OMC Textile Division Presentation 2021.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Hybrid model detection and classification of lung cancer
Web App vs Mobile App What Should You Build First.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MIND Revenue Release Quarter 2 2025 Press Release
SOPHOS-XG Firewall Administrator PPT.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
A comparative analysis of optical character recognition models for extracting...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
NewMind AI Weekly Chronicles - August'25-Week II
A novel scalable deep ensemble learning framework for big data classification...

Kubernetes Security

  • 2. • I’m Karthik Gaekwad • NOT a DBA • https://cloudnative.oracle.com/ • Cloud Native evangelist at OCI • Used to be a developer on the OKE Team. Hello @iteration1
  • 3. Hello • Been in Industry 15 years. • In general, I like building stuff with friends. • A maintainer for Gauntlt- Open source security scanner. • Love Teaching and building community. • Run Devopsdays Austin, Container Days, Cloud Austin. • Chair All Day Devops Cloud Native track. • LinkedIn Learning Author for Learning Kubernetes (and more).
  • 4. Need an OCI Trial Account? http://bitly.com/ocicloud
  • 6. The Cloud Native Journey 6 Phase I Developer Focus Phase II DevOps Focus Phase III Business Focus (end-to-end) Container Adoption Application Deployment Intelligent Operations SpeedEfficiencyAgility Docker Kubernetes Core to Edge Developer adoption Dev/Test apps Simple orchestration Individual developers DevOps deployment Production apps Advanced orchestration Teams & lines of business End-to-end integration Digital business apps Serverless, DevSecOps, & ML Cloud native enterprises Focus Applications Automation Community
  • 7. Latest CNCF Survey: August 2018 How Does Your Company Use Containers and Where?
  • 8. Kubernetes Dominates Container Management Your company/organization manages containers with:
  • 9. Good News, Bad News… Good: On average, CNCF project usage is up over 200% since the Dec 2017! But...
  • 10. Complexity, Culture, Training, & Security Issues Remain
  • 11. • Managing, maintaining, upgrading Kubernetes Control Plane • API Server, etcd, scheduler etc…. • Managing, maintaining, upgrading Kubernetes Data Plane • In place upgrades, deploy parallel cluster etc…. • Figuring out container networking & storage • Overlays, persistent storage etc… - it should just work • Managing Teams • How do I manage & control team access to my clusters? • Security, security, security Kubernetes & Cloud Native Challenges 11 Source: Oracle Customer Survey 2018
  • 12. How Are Teams Addressing Complexity, Training Issues? App Management Upgrades & Patching Platform Backup & Recovery High Availability Scaling App Deployment Power, HVAC Rack and Stack Server Provisioning Software Installation Customer Managed Fully-Managed App Management Upgrades & Patching Platform Backup & Recovery High Availability Scaling App Deployment Power, HVAC Rack and Stack Server Provisioning Software Installation  Faster Time to Deploy  Lower Risk  Accelerate Innovation Benefits YOU
  • 13. Which brings us to security…
  • 14. Where no news, is good news!
  • 15. Unsecured K8s dashboards • Unsecured Kubernetes Dashboard with account creds. • Used this to mine cryptocurrency. • 2017: Aviva • 2018: Tesla, Weight Watchers • https://redlock.io/blog/cryptoja cking-tesla
  • 16. Kubelet credentials hack • Shopify: Server Side request Forgery • Get kubelet certs/private key • Root access to any container in part of infrastructure. • https://hackerone.com/reports/ 341876
  • 21. WAT?
  • 22. How did we get here?
  • 23. “Kubernetes is too complicated”
  • 24. “Kubernetes is too complicated” “We hope it’ll get easier”
  • 25. What is your strate
  • 26. Let’s look at: •Attack Surface • More importantly, how to limit damage •Security related features in K8s • The more you know, the better you build •Opensource Tooling to help • Because we all need help
  • 28. Attack Surface Goal: Reduce the attack surface •Analysis for: •Host •Container (Images and running) •Kubernetes Cluster
  • 29. Attack Surface • Work on reducing the attack surface: • Analysis for: • Host • Container (Images and running) • Kubernetes Cluster
  • 30. Attack Surface: Host • These are the machines you’re running Kubernetes on. • Age old principles of Linux still apply: • Enable SELinux • AppArmor • Seccomp • Goal: Minimize privilege to applications running on the host
  • 31. Attack Surface: Container Images • Know your base image when building containers • Smaller the better • Don’t rely on :latest tag • Check for vulnerabilities periodically
  • 32. Attack Surface: Running Containers • Don’t run as root • Limit host mounts
  • 33. Attack Surface: Kubernetes Cluster • TLS • Audit Logs • Network Policies • Pod Security Policies • Secrets
  • 34. Kubernetes Cluster: TLS TLS ALL THE THINGS
  • 35. Attack Surface: Host • These are the machines you’re running Kubernetes on. • Age old principles of Linux still apply: • Enable SELinux • AppArmor • Seccomp • Hardened Images • Goal: Minimize privilege to applications running on the host • Good news: Already a wealth of information on this subject! • http://lmgtfy.com/?q=how+to+reduce+attack+surface+linux
  • 36. Attack Surface: Container Images GOAL: Know your base image when building containers
  • 37. Attack Surface: Container Images GOAL: Know your base image when building containers **BTW, this is just a ruby helloworld app
  • 38. Attack Surface: Container Images GOAL: Know your base image when building containers **BTW, this is just a ruby helloworld app
  • 39. Attack Surface: Container Images GOAL: Know your base image when building containers Full disclosure: I’m karthequian; I created this as a ruby 101 container for learning purposes only
  • 40. Attack Surface: Container Images GOAL: Know your base image when building containers • When in doubt, stick to an official images! • Or start from a sane base image (example: alpine linux)
  • 41. Attack Surface: Container Images GOAL: Smaller the image, the better • Less things for an attacker to exploit. • Quicker to push, quicker to pull.
  • 42. Attack Surface: Container Images GOAL: Don’t rely on :latest tag • :latest image yesterday might not be :latest image tomorrow • Instead, you’d want to know what specific version you’re operating with. • Side benefit: If there is a new vulnerability announced for OS version x.y.z, you know immediately whether you’re running that version!
  • 43. Attack Surface: Container Images GOAL: Check for vulnerabilities periodically • Plenty of ways to do this in registries. We’ll cover more in the tooling section
  • 44. Attack Surface: Running Containers GOAL: Don’t run as root • Containers running as root might be completely unnecessary for the actual application. • If compromised, attacker can do a lot more things.. • Pod security policies can help (we’ll see how later).
  • 45. Attack Surface: Running Containers GOAL: Limit host mounts • Be wary of images that require broad access to paths on the host • Limit your host mount to a smaller subset of directories • Reduces blast radius on compromise
  • 47. Kubernetes Cluster- TLS TLS ALL THE THINGS
  • 48. Kubernetes Cluster- TLS • TLS Checklist: 1. Nodes and Master 2. User and Master 3. Everything etcd 4. Kubelet to API Server
  • 50. Kubernetes Cluster- TLS • TLS Checklist: 1. User and Master 2. Nodes and Master 3. Everything etcd 4. Kubelet to API Server
  • 51. We’re a little better off now. But what else to do?
  • 52. K8s Features How can the platform help me make secure choices?
  • 53. K8s Features • Authentication • Authorization • Audit Logging • Network Policies • Pod security policies • Kubernetes Secrets
  • 54. Authentication and Authorization • Do you know how you are authenticating with Kubernetes? • Many ways to Authenticate • Client Certs • Static token file • Service Account tokens • OpenID • Webhook Mode • And more (https://kubernetes.io/docs/reference/access-authn-authz/authentication/)
  • 55. Whatever you do, DO NOT YOLO! Goal: Pick a strategy that fits your use case
  • 56. You can pick an authz strategy.. If you DO NOT YOLO…
  • 58. Authentication and Authorization • Pro tip: Nobody uses ABAC anymore. Don’t be that guy…. • RBAC is the defacto standard • Based on roles and role bindings • Good set of defaults: https://github.com/uruddarraju/kubernetes-rbac-policies • Can use multiple authorizers together, but can get confusing. • 1st authorizer to authorize passes authz
  • 59. Kubernetes Cluster- Audit Logs • Wat? • “Kubernetes auditing provides a security-relevant chronological set of records documenting the sequence of activities that have affected system by individual users, administrators or other components of the system.” • Answers: What/when/who/where information on security events. • Your job: Periodically watch Kubernetes Audit logs • https://kubernetes.io/docs/tasks/debug-application-cluster/audit/
  • 61. Kubernetes Cluster- Network Policies • Consider adding a network policy to the cluster… • Default Policy: All pods can talk to all other pods. • Consider limiting this with a Network Policy • https://kubernetes.io/docs/concepts/services-networking/network-policies/
  • 62. Kubernetes Cluster- Pod Security Policies • Consider adding Pod Security policies • PodSecurityPolicy: A Defined set of conditions a pod must run with. • Think of this as authorization for pods.
  • 63. Kubernetes Cluster: Pod Security Policies https://kubernetes.io/docs/concepts/policy/pod-security-policy/#what-is-a-pod-security-policy Capability for an admin to control specific actions
  • 64. Kubernetes Secrets • GOAL: Use Kubernetes secrets to store sensitive data instead of config maps. • Also look at: secrets encryption provider. • Controls how etcd encrypts API data • --experimental-encryption-provider-config • https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/
  • 66. Keep tabs on the CNCF Security landscape https://landscape.cncf.io/landscape=security-compliance
  • 67. CNCF Projects • “The Update Framework” • Is a framework or a methodology. • Used for secure software updates. • Based on ideas surrounding trust and integrity. • Is a project. • Based on TUF. • A solution to secure software updates and distribution. • Used in Docker Trusted Registry.
  • 68. Clair • Open source project for the static analysis of vulnerabilities in containers. • Find vulnerable images in your repo. • Built into quay.io, but you can add to your own repo. • https://github.com/coreos/clair
  • 70. Kube-bench • Checks whether a Kubernetes cluster is deployed according to security best practices. • Run this after creating your K8s cluster. • https://github.com/aquasecurity/kube-bench • Defined by the CIS Benchmarks Docs: https://www.cisecurity.org/cis- benchmarks/ • Run it against your Kubernetes Master, or Kubernetes node.
  • 72. Kubesec • Helps you quantify risk for Kubernetes resources. • Run against your K8s applications (deployments/pods/daemonsets etc) • https://kubesec.io/ from controlplane • Can be used standalone, or as a kubectl plugin (https://github.com/stefanprodan/kubectl-kubesec)
  • 74. Kubeaudit • Opensourced from Shopify. • Auditing your applications in your K8s cluster. • https://github.com/Shopify/kubeaudit • Little more targeted than Kubesec.
  • 77. “So much time and so little to do.”
  • 78. Couple more resources to look at: • 11 ways not to get hacked: https://kubernetes.io/blog/2018/07/18/11-ways-not-to-get-hacked • K8s security (from Image Hygiene to Network Policy): https://speakerdeck.com/mhausenblas/kubernetes-security-from- image-hygiene-to-network-policies

Editor's Notes

  • #12: However, customers face challenges along the way.  As we have spoken to customers, many have agreed with the challenges presented on this slide.
  • #13: Faster Time to Deploy No need to provision and maintain Operating System and Platforms (Linux, Kubernetes, Docker Registry, Continuous Integration Systems) Lower Risk Oracle is committed to SLAs on Performance and Manageability, in addition to Availability Accelerate Innovation Develop new Container Native apps quickly, and port existing apps faster
  • #24: Photo by Byron Sterk on Unsplash
  • #25: Photo by Byron Sterk on Unsplash
  • #26: Photo by rawpixel on Unsplash
  • #28: Photo by rawpixel on Unsplash
  • #47: Photo by rawpixel on Unsplash
  • #50: Diagram from https://docs.google.com/presentation/d/1Gp-2blk5WExI_QR59EUZdwfO2BWLJqa626mK2ej-huo/edit#slide=id.g1e639c415b_0_56. Thanks @Lucas Käldström
  • #56: Photo by Mikhail Vasilyev on Unsplash
  • #57: Photo by Mikhail Vasilyev on Unsplash
  • #66: Photo by Barn Images on Unsplash