Certified Kubernetes Security Specialist (CKS) Study Guide

Book description

Exclusively on O'Reilly: Get more hands-on training and test your CKS exam readiness by working through the Certified Kubernetes Security Specialist (CKS) Exam Prep Labs playlist. This collection of interactive labs provides hands-on training that enhances the exam prep provided by this study guide.

Vulnerabilities in software and IT infrastructure pose a major threat to organizations. In response, the Cloud Native Computing Foundation (CNCF) developed the Certified Kubernetes Security Specialist (CKS) certification to verify an administrator's proficiency to protect Kubernetes clusters and the cloud native software they contain. This practical book helps you fully prepare for the certification exam by walking you through all of the topics covered.

Different from typical multiple-choice formats used by other certifications, this performance-based exam requires deep knowledge of the tasks it covers under intense time pressure. If you want to pass the CKS exam on the first go, author Benjamin Muschko shares his personal experience to help you learn the objectives, abilities, and tips and tricks you need to pass on the first attempt.

  • Identify, mitigate, and/or minimize threats to cloud native applications and Kubernetes clusters
  • Learn the ins and outs of Kubernetes's security features, and external tools for security detection and mitigation purposes
  • Demonstrate competency to perform the responsibilities of a Kubernetes administrator or application developer with a security viewpoint
  • Solve real-world Kubernetes problems in a hands-on, command-line environment
  • Effectively navigate and solve questions during the CKS exam

Table of contents

  1. Preface
    1. Who This Book Is For
    2. What You Will Learn
    3. Structure of This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Acknowledgments
  2. 1. Exam Details and Resources
    1. Kubernetes Certification Learning Path
      1. Kubernetes and Cloud Native Associate (KCNA)
      2. Kubernetes and Cloud Native Security Associate (KCSA)
      3. Certified Kubernetes Application Developer (CKAD)
      4. Certified Kubernetes Administrator (CKA)
      5. Certified Kubernetes Security Specialist (CKS)
    2. Exam Objectives
    3. Curriculum
      1. Cluster Setup
      2. Cluster Hardening
      3. System Hardening
      4. Minimize Microservice Vulnerabilities
      5. Supply Chain Security
      6. Monitoring, Logging, and Runtime Security
    4. Involved Kubernetes Primitives
    5. Involved External Tools
    6. Documentation
    7. Candidate Skills
    8. Practicing and Practice Exams
    9. Summary
  3. 2. Cluster Setup
    1. Using Network Policies to Restrict Pod-to-Pod Communication
      1. Scenario: Attacker Gains Access to a Pod
      2. Observing the Default Behavior
      3. Denying Directional Network Traffic
      4. Allowing Fine-Grained Incoming Traffic
    2. Applying Kubernetes Component Security Best Practices
      1. Using kube-bench
      2. The kube-bench Verification Result
      3. Fixing Detected Security Issues
    3. Creating an Ingress with TLS Termination
      1. Setting Up the Ingress Backend
      2. Creating the TLS Certificate and Key
      3. Creating the TLS-Typed Secret
      4. Creating the Ingress
      5. Calling the Ingress
    4. Protecting Node Metadata and Endpoints
      1. Scenario: A Compromised Pod Can Access the Metadata Server
      2. Protecting Metadata Server Access with Network Policies
    5. Protecting GUI Elements
      1. Scenario: An Attacker Gains Access to the Dashboard Functionality
      2. Installing the Kubernetes Dashboard
      3. Accessing the Kubernetes Dashboard
      4. Creating a User with Administration Privileges
      5. Creating a User with Restricted Privileges
      6. Avoiding Insecure Configuration Arguments
    6. Verifying Kubernetes Platform Binaries
      1. Scenario: An Attacker Injected Malicious Code into Binary
      2. Verifying a Binary Against Hash
    7. Summary
    8. Exam Essentials
    9. Sample Exercises
  4. 3. Cluster Hardening
    1. Interacting with the Kubernetes API
      1. Processing a Request
      2. Connecting to the API Server
    2. Restricting Access to the API Server
      1. Scenario: An Attacker Can Call the API Server from the Internet
      2. Restricting User Permissions
      3. Scenario: An Attacker Can Call the API Server from a Service Account
      4. Minimizing Permissions for a Service Account
    3. Updating Kubernetes Frequently
      1. Versioning Scheme
      2. Release Cadence
      3. Performing the Upgrade Process
    4. Summary
    5. Exam Essentials
    6. Sample Exercises
  5. 4. System Hardening
    1. Minimizing the Host OS Footprint
      1. Scenario: An Attacker Exploits a Package Vulnerability
      2. Disabling Services
      3. Removing Unwanted Packages
    2. Minimizing IAM Roles
      1. Scenario: An Attacker Uses Credentials to Gain File Access
      2. Understanding User Management
      3. Understanding Group Management
      4. Understanding File Permissions and Ownership
    3. Minimizing External Access to the Network
      1. Identifying and Disabling Open Ports
      2. Setting Up Firewall Rules
    4. Using Kernel Hardening Tools
      1. Using AppArmor
      2. Using seccomp
    5. Summary
    6. Exam Essentials
    7. Sample Exercises
  6. 5. Minimizing Microservice Vulnerabilities
    1. Setting Appropriate OS-Level Security Domains
      1. Scenario: An Attacker Misuses root User Container Access
      2. Understanding Security Contexts
      3. Enforcing the Usage of a Non-Root User
      4. Setting a Specific User and Group ID
      5. Avoiding Privileged Containers
      6. Scenario: A Developer Doesn’t Follow Pod Security Best Practices
      7. Understanding Pod Security Admission (PSA)
      8. Enforcing Pod Security Standards for a Namespace
      9. Understanding Open Policy Agent (OPA) and Gatekeeper
      10. Installing Gatekeeper
      11. Implementing an OPA Policy
    2. Managing Secrets
      1. Scenario: An Attacker Gains Access to the Node Running etcd
      2. Accessing etcd Data
      3. Encrypting etcd Data
    3. Understanding Container Runtime Sandboxes
      1. Scenario: An Attacker Gains Access to Another Container
      2. Available Container Runtime Sandbox Implementations
      3. Installing and Configuring gVisor
      4. Creating and Using a Runtime Class
    4. Understanding Pod-to-Pod Encryption with mTLS
      1. Scenario: An Attacker Listens to the Communication Between Two Pods
      2. Adopting mTLS in Kubernetes
    5. Summary
    6. Exam Essentials
    7. Sample Exercises
  7. 6. Supply Chain Security
    1. Minimizing the Base Image Footprint
      1. Scenario: An Attacker Exploits Container Vulnerabilities
      2. Picking a Base Image Small in Size
      3. Using a Multi-Stage Approach for Building Container Images
      4. Reducing the Number of Layers
      5. Using Container Image Optimization Tools
    2. Securing the Supply Chain
      1. Signing Container Images
      2. Scenario: An Attacker Injects Malicious Code into a Container Image
      3. Validating Container Images
      4. Using Public Image Registries
      5. Scenario: An Attacker Uploads a Malicious Container Image
      6. Whitelisting Allowed Image Registries with OPA GateKeeper
      7. Whitelisting Allowed Image Registries with the ImagePolicyWebhook Admission Controller Plugin
      8. Implementing the Backend Application
      9. Configuring the ImagePolicyWebhook Admission Controller Plugin
    3. Static Analysis of Workload
      1. Using Hadolint for Analyzing Dockerfiles
      2. Using Kubesec for Analyzing Kubernetes Manifests
    4. Scanning Images for Known Vulnerabilities
    5. Summary
    6. Exam Essentials
    7. Sample Exercises
  8. 7. Monitoring, Logging, and Runtime Security
    1. Performing Behavior Analytics
      1. Scenario: A Kubernetes Administrator Can Observe Actions Taken by an Attacker
      2. Understanding Falco
      3. Installing Falco
      4. Configuring Falco
      5. Generating Events and Inspecting Falco Logs
      6. Understanding Falco Rule File Basics
      7. Overriding Existing Rules
    2. Ensuring Container Immutability
      1. Scenario: An Attacker Installs Malicious Software
      2. Using a Distroless Container Image
      3. Configuring a Container with a ConfigMap or Secret
      4. Configuring a Read-Only Container Root Filesystem
    3. Using Audit Logs to Monitor Access
      1. Scenario: An Administrator Can Monitor Malicious Events in Real Time
      2. Understanding Audit Logs
      3. Creating the Audit Policy File
      4. Configuring a Log Backend
      5. Configuring a Webhook Backend
    4. Summary
    5. Exam Essentials
    6. Sample Exercises
  9. Appendix. Answers to Review Questions
    1. Chapter 2, “Cluster Setup”
    2. Chapter 3, “Cluster Hardening”
    3. Chapter 4, “System Hardening”
    4. Chapter 5, “Minimize Microservice Vulnerabilities”
    5. Chapter 6, “Supply Chain Security”
    6. Chapter 7, “Monitoring, Logging, and Runtime Security”
  10. Index
  11. About the Author

Product information

  • Title: Certified Kubernetes Security Specialist (CKS) Study Guide
  • Author(s): Benjamin Muschko
  • Release date: June 2023
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098132972