Skip to main content
Account
Lesson 1 of 6

Introduction to Teleport for Kubernetes

Understand the problem with default Kubernetes access — long-lived credentials, no revocation, and audit gaps — and how Teleport solves it with short-lived certificates, real identities, and full audit logging.

In collaboration with Teleport

Introduction to Teleport for Kubernetes

Welcome to Teleport for Kubernetes

Over the next six videos, we go from zero to a fully working setup — identity-based access, role-based controls, just-in-time privilege escalation, and full audit logging. Everything you need to lock down Kubernetes access the right way.

The Problem

If you’ve been working with Kubernetes, you’re familiar with kubeconfig files. The standard way to authenticate with any Kubernetes cluster — you get the file, drop it into ~/.kube/config, and off you go. But have you ever looked inside a kubeconfig file?

Typically, your kubeconfig contains a long-lived secret. These certificates live for months or years with no ability to revoke them unless you rotate the entire certificate authority of your cluster. The subject is always generic — kubernetes-admin — because Kubernetes has no real concept of users.

This creates audit gaps: when everyone shares the same identity, it’s hard to tell who did what. And in our AI landscape, your AI agents potentially have access to all of your clusters with the same permissions you have.

The Solution: Teleport

Teleport is an infrastructure access platform that sits in front of your Kubernetes clusters, SSH servers, databases, and web applications. It provides a single unified layer for authentication and authorization with complete audit capabilities.

Instead of handing out long-lived credentials, Teleport acts as your certificate authority. When you authenticate through your company’s SSO — Okta, Google Workspace, or GitHub — Teleport issues you a short-lived x509 certificate containing your real identity, roles, and an expiration time. By default, certificates are valid for around 12 hours.

How Teleport Works

Under the hood, there are three core services:

  1. Auth Service — The brain of Teleport. It runs a certificate authority, stores cluster state, users, roles, connectors, and writes to the audit log.
  2. Proxy Service — Your public-facing gateway. It handles protocol detection and routing — the same port can serve the web UI, SSH connections, Kubernetes API requests, and database connections through Multiplex Mode.
  3. Kubernetes Service — The agent that connects Teleport to your Kubernetes cluster’s API server. It maintains a reverse tunnel back to the proxy, meaning your API server never needs to be exposed to the internet.

What’s Ahead

In this course, we’ll walk through deploying Teleport with Helm, setting up GitHub SSO, building fine-grained RBAC with defense in depth, implementing just-in-time access requests, and exploring audit logging and session recording.

Transcript

Generated from English captions. Select a timestamp to jump to that moment.

0:00 Hello, and welcome to the Teleport for Kubernetes course. I'm excited to walk you through everything that you need to know to deploy, configure, and operate Teleport as the access layer for your Kubernetes clusters. Over the next six videos, we're gonna go from zero to a fully working setup, identity-based access, role-based controls, just in time, privilege escalation, with full audit logging. Everything that you need to lock down Kubernetes access the right way. Now, before we build anything, we need to understand the problem that we're solving. So let's begin. If you've been working with Kubernetes for any amount of time, and I will

0:50 assume you're watching this video, so of course you have, then you're familiar with kubeconfig files. The standard way to authenticate with any Kubernetes Cluster, you get the files, you drop it into your home directory .kube/config, and off you go. You can kubectl your way into all the problems in the world. But have you ever looked inside of a kubeconfig file? So let's start by taking a look at one now. All right, so let's take a look. This is an example kubeconfig file. Like everything in Kubernetes, we have a kind and an API version. The kubeconfig is no different.

1:32 A kubeconfig can host a configuration for one or more clusters. So as you can see, we have clusters, which is a list. This will have the server, the IP address, or host name for your API server, and you'll have some sort of base64 encoded CA certificate. You then have multiple contexts, which can span multiple clusters and multiple users. And then of course we have our users. Well, Kubernetes has no real concept of a user. It does have some ability to authenticate with the cluster. Now, these certificates are not special. They're just x509 certificates. With issuers, subjects, not before, not after all the basic stuff you

2:13 would accept from any standard So typically what you will see is that your kubeconfig has some sort of long lived secret. Typically, these live for months or years. There's also no ability to revoke these certificates unless you change the root certificate authority within your cluster, which is no easy task. The subject is always very generic. kubernetes-admin. Again, there is no concept of users within a Kubernetes Cluster. Now, while you may not always get system:masters with root access to your cluster. When you spin up a cluster on your cloud provider of choice, this is typically what you are given.

2:57 And again, revoking access means rotating the entire certificate authority of your cluster, regenerating all your certificates. This is hard. And, and our AI landscape. When you have your kubeconfig living as a file on your disk, your AI agents potentially have access to all of your clusters as well, including production with the same authentication, the same capabilities, the same role access that you yourself have. Now, what about the audit gaps? What do I mean by audit gaps? Well, Kubernetes does have audit capabilities, but they only work well when every user has a unique identity. When everyone is sharing that same Kubernetes admin identity.

3:42 It's hard to tell who did what. Here we have the real kubectl get events from one of my production clusters, and as you can tell, there's no concept of who did anything. We can see pods being scheduled, images being pulled. Containers were started, but not who created anything. Which user run kubectl exec. What commands are executed inside of a shell session? Right? We all have the ability to run kubectl debug and kubectl exec, and there's no why for anything was scaled. Why did we change the replicas from 3 to 0? right? Were we performing some form of maintenance?

4:20 All of this context is lost. Now, Kubernetes does have audit policies and audit logs that are a bit more but again, if we are using x509 certificates provisioned by our cloud provider of choice, and that's typically just given us the Kubernetes admin access to the cluster, we're losing out on a lot of very important information. We lose out on the who? We lose out on the why. All we get is a what? I think we've covered the problem space. Well now I wanna show you the solution. I've been using Teleport since 2018, and in fact, every episode of

5:02 Klustered that has ever aired has always been powered by Teleport. Now, in case you're not familiar with Teleport, Teleport is an infrastructure access platform It sits in front of your infrastructure, Kubernetes clusters, SSH servers, databases, web applications, you name it. It provides a single unified layer for authentication and authorization with complete audit capabilities. The core idea is deceptively simple. Instead of handing out long lived credentials, Teleport will act as your certificate authority when you authenticate through your company's SSO. Something like Okta Google Workspace or even GitHub. Teleport issues you a short-lived x509 certificate. This certificate contains your real identity, your

5:51 roles, and an expiration time. By default, certificates are valid for around 12 hours, and when they expire, you have to re-authenticate. It solves, or at least mitigates the problem of long lived credentials where there's no ability to revoke, and doing so is a painful, cluster wide operation. Teleport provides us a zero trust model. No standing credentials, no shared secrets, and every access attempt starts with a fresh authentication event that is tied to a real human identity or perhaps a robot. We'll get into that later. For Kubernetes specifically, this means that when you run kubectl get

6:31 pods, the request carries a certificate that says, this is David Flanagan. He has the dev team role. And this certificate expires in 11 hours. The Kubernetes API server sees a real identity. The RBAC policy is attached to me, and those can be as granular as we need, as we will see throughout this course. And now your audit logs contain something actually meaningful and it helps you triage when the time occurs. Teleport is open source, at least the Community Edition is completely open source and free for anyone to use with GitHub backed SSO, and it's what we'll be using in this course.

7:12 Now, of course, there is an enterprise edition and a cloud edition that supports features like SAML connectors, hooking up to Okta and Google Workspace, HSM support, and the Teleport policy engine. So if that's a value to you and your company, click the link in the description below to learn more. But please bear mind everything we build in this course works with the community edition. So now let's talk about how Teleport actually works. Under the hood, there are three core services. And understanding how they interact is essential before you start deploying First up, we have the auth service.

7:51 This is the brain of teleport. It runs a certificate authority that issues and signs all certificates. It stores cluster state, users, roles, connectors, trusted clusters, and it writes to the audit log. Every authentication event, every kubectl command, every exec session Gets recorded. The auth service should never be directly exposed to the internet, and it sits behind the proxy service and communicates over mTLS the way modern secure applications should. Communicate. So then the second service is of course the proxy service. This is your public facing gateway. It's what your users actually connect and speak to. When you run TSH login, you're talking to the proxy service.

8:37 It handles protocol detection and routing. The same port can serve actually the web ui, SSH connections, Kubernetes API requests and database connections, depending on how far you push your Teleport adoption. This is done through a feature called Multiplex Mode, where a single port, usually it's 443, handles all your protocols, and it's one of my favorite features. The proxy service authenticates incoming requests and routes them to the appropriate backend service, which I introduce you as to service three, the Kubernetes service. This is the agent that connects teleport to your Kubernetes clusters, API server. It can run inside the cluster as a pod or outside the cluster pointing it.

9:20 The Kubernetes service maintains a reverse tunnel back to the proxy service, which means that your Kubernetes API server never needs to be exposed to the internet. Traffic flows in through the proxy, gets routed to the Kubernetes service through the tunnel and the Kubernetes service forwards it to the API server using its own service account credentials. All of this complexity is handled for you if you use the Helm chart, which we'll be covering soon. The main takeaway from all of this information. Is every step, every flow when use Teleport to access your cluster is authenticated with mutual TLS.

10:00 Every request is logged and the entire chain is based on a certificate that expires and hours and not months. And in this course, we are going to run everything a kind cluster on your local machine, meaning you can try this right now. We're just following along with this course and type in the exact same commands that I'm typing. Don't worry if you don't have domain names and cloud infrastructure to throw at it yet. We're keeping this super simple. So what can you expect over the next five videos? Well, we're gonna walk through a production deployment.

10:33 Using Kind still locally, but making sure we cover the considerations that you need. Moving this into your real production infrastructure, such as C and accessing the web UI through SSO. We will be using GitHub as our identity provider because it is available on the community edition. That means we'll be mapping our GitHub identities to teleport roles and showing you how to use tsh login and removing kubeconfigs from your life entirely. We'll be using Kubernetes roles and federating this for teleport roles so that they work together. You'll see how to give developers read access to one namespace while

11:17 blocking access to everything else and how teleport can enforce this through its short-lived certificate groups. As we progress through the rest of the videos, we'll be taking a look at access request and just in time privilege. Again, another one of my favorite features. We'll be implementing a workflow where no one has right access or admin access to a Kubernetes cluster, but showing you how your engineers can request elevated privilege that can be approved by one or more people within your organization. And then we'll move on to Teleports audit log. Where we actually have the ability to rewatch sessions, even when

11:56 they're using kubectl exec. Every video in this course includes runable demo scripts that you can execute in your own machine. Everything is publicly available in the Rawkode Academy, GitHub repository, and link in the descriptions for each video. I strongly recommend that you follow along. This material does stick much better when it's tactile, when you're building it for yourself. Alright, that is enough of the talkie talkie. I've given you enough information, you know what to expect. There's now time to make things happen. I'll see you in the next video as we apply teleport from scratch.

Course curriculum (6 lessons)
  1. 01. Introduction to Teleport for Kubernetes
  2. 02. Deploying a Teleport Cluster on Kubernetes
  3. 03. Identity-Based User Access & RBAC
  4. 04. Two-Layer RBAC with Teleport Boundaries
  5. 05. Just-in-Time Access for Incidents
  6. 06. Auditing and Session Recording

Loading optional course email signup. If it does not load, reload this lesson to retry. Signup requires JavaScript; all lesson content remains available without signing up.