hands-on lab

Securing Kubernetes Clusters using Authentication and Authorization

Up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


There are many facets to security in Kubernetes. One small oversight can leave your cluster vulnerable to leaking sensitive data, running foreign workloads, and a host of other attacks. This lab shows you how to practice defense in depth in Kubernetes by covering the main security concepts including authentication, and authorization. Examples of potential exploits from improperly configured clusters are also illustrated followed by guidance on how to prevent the attacks.

This lab is valuable to anyone working with Kubernetes, but the content has been prepared considering topics described in the Certified Kubernetes Administrator (CKA) Exam Curriculum. Completion of the lab will help you get hands-on experience, which is essential for passing the CKA exam.

Learning Objectives

Upon completion of this lab you will be able to:

  • Understand Kubernetes' authentication model
  • Create users and groups in Kubernetes and use role-based access control for authorization

Intended Audience

  • Kubernetes cluster administrators
  • Certified Kubernetes Administrator (CKA) examinees


You should be familiar with:

  • Working with Kubernetes to deploy applications
  • Working at the command line in Linux
  • Public Key Infrastructure (PKI), particularly using OpenSSL to generate keys and certificates

The following Labs can be used to fulfill the prerequisites: Deploy a Stateless Application in a Kubernetes ClusterDeploy a Stateful Application in a Kubernetes Cluster, and Best Practices for Deploying SSL/TLS.



October 13th, 2023 - Updated Kubernetes to 1.28

June 13th, 2023 - Updated Kubernetes to 1.26

December 2nd, 2022 - Updated instructions to switch back to the admin context

Environment before

Environment after

About the author

Logan Rakai, opens in a new tab
Lead Content Developer - Labs
Learning paths

Logan has been involved in software development and research since 2007 and has been in the cloud since 2012. He is an AWS Certified DevOps Engineer - Professional, AWS Certified Solutions Architect - Professional, Microsoft Certified Azure Solutions Architect Expert, MCSE: Cloud Platform and Infrastructure, Google Cloud Certified Associate Cloud Engineer, Certified Kubernetes Security Specialist (CKS), Certified Kubernetes Administrator (CKA), Certified Kubernetes Application Developer (CKAD), and Certified OpenStack Administrator (COA). He earned his Ph.D. studying design automation and enjoys all things tech.

LinkedIn, Twitter, GitHub

Covered topics

Lab steps

Connecting to the Kubernetes Cluster
Configuring Kubernetes Authentication
Configuring Kubernetes Authorization