Skip to main content
Account
Lesson 5 of 6

Just-in-Time Access for Incidents

Implement just-in-time access requests so nobody has standing admin privileges — when paged at 3 AM, engineers request temporary elevated access that is peer-reviewed and time-bounded.

In collaboration with Teleport

Just-in-Time Access for Incidents

The Problem with Standing Privileges

Role-based access control is a great foundation, but on-call engineers need the ability to respond to incidents at 3 AM. The traditional approach gives them permanent cluster admin access — a security liability. If credentials are compromised, the attacker inherits everything. From a compliance perspective, frameworks like SOC 2, FedRAMP, and ISO 27001 increasingly expect least privilege with time-bounded access.

Just-in-Time Access

The idea is simple: nobody has admin access by default. When paged, you submit a request, explain why you need it, it gets peer-reviewed, and you get temporary access. Fix the issue, go back to bed.

Teleport calls these access requests — a first-class feature built into the platform. No external ticketing system required, no custom code or scripts.

Implementation

We modify the existing dev team and prod team roles to add access request capabilities, plus create a new elevated kube-admin role with a one-hour TTL:

  1. Add allow.request to existing roles so users can request the kube-admin role
  2. Create the kube-admin role with system:masters access and a short TTL
  3. Request flow: tsh request create --roles=kube-admin --reason="debugging production for client XYZ"
  4. Approval: Admin approves via tctl request approve
  5. Login with elevated access: tsh login --request-id=<id>
  6. Drop privileges: tsh request drop returns to normal access

The one-hour TTL means even in the worst case, the window of elevated privilege is time-bounded. Tune this to your organization’s needs — 15 minutes, 30 minutes, or 6 hours for a maintenance period.

Transcript

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

0:00 In the last video, we set up role-based access control, giving each user exactly the Kubernetes permissions that they need. It's a great foundation, but we still got some problems to solve. Imagine you are on call and responsible for production infrastructure, and you need the ability to respond to incidents at three o'clock in the morning when your pager's gone off. The fastest way to do this has to have Cluster admin, the ability to debug pods, read logs, and restart workloads. The traditional approach is to give them that access, permanently standing privileges that are always active, whether they're using them or not,

0:39 like your standard cloud provider, kubeconfig, and as we discussed, that is a security liability. If your credentials are compromised, the attacker inherits everything that engineer you can do. Now, if someone makes a mistake during a quiet Tuesday afternoon, they have the same blast radius as during an actual incident. And from a compliance perspective, frameworks like SOC 2, FedRAMP ISO 27001, they increasingly expect organizations to implement the principle of least privilege, meaning users should only have elevated access when they actually need it. Not around the clock, not permanently. Auditors will ask for you to demonstrate that access is controlled and time

1:28 bounded standing privileges make that very difficult, near impossible to prove. So this is where just in time access comes in, and the idea could not be simpler. Nobody has admin access. Woo-hoo. When do you need it? When you get paged at three o'clock in the morning, you submit a request, you explain why you need it. It is peer reviewed and you get temporary access to do your job, go back to bed and get back to sleep. Teleport calls us access requests and it's built into the platform. No external ticketing system required no custom code or scripts.

2:07 It's the first class feature that works well with the CLI and the web ui. Let's take a look. So to make access requests work, we're not gonna create any new roles, but we are going to modify the dev team and prod team roles from the previous video. We just need to add the access request capabilities to them, plus create one new elevated role for the approval process. Now if we pop open our new dev team role, you'll see here that we're just adding allow requests where the request can ask for the kube-admin role. Simple. So let's run a script to apply these changes to production.

3:02 We can see the dev team has been updated. We should, in theory, now be able to request are elevated privileges. Now is worth noting that if you are using Teleport Enterprise, you do have the ability to specify a threshold of minimum approvers or deniers on any request. Not available in the Community edition and not required for today's demo, but in an enterprise setup, you may want to make sure that two people approve every single request for a little bit of extra security posture. so if we go ahead and we try to apply the approval rule, unfortunately.

3:40 This is going to fail. The reason will be when it pops up. Now, the problem here is that review requests is only available on an enterprise license if you or not. That doesn't mean that we can't have a cool demo, and you still can't use this on the community edition. It just means all role requests must be approved by a teleport admin. Rather than being able to delegate it to roles like we were trying to do here. So if you're on enterprise, check out the scripts. Use request reviews, make it a role-based thing. Add your thresholds.

4:16 Honestly, the feature is amazing, but in community, we'll be, uh, approving these with our teleport admin user. Let's move on. So the next manifest we have is the kube-admin rule. This is just a teleport rule that has system master Cluster admin access across your Cluster. So we can apply this as well to our Cluster like so. As a note says here, this has a one hour TTL, so we're only giving them temporary access, verifying the rules created, and that looks smashing. Perfect. Now that one RTTL is important, right? It means that even in the worst case where someone's access

5:04 gets approved accidentally. Um, the window of that elevated privilege is time bounded, and this is the most important takeaway from this, right? When you give people elevated privileges in any system, you want to make sure that they don't have that indefinitely offered more than they need to do their job. Now, you can tune this to what makes sense within your organization that maybe you just want to give them it for 15 minutes, 30 minutes, or perhaps it's six hours for a maintenance period. You work out what is the right needs for you, your team, and your operational needs.

5:43 So I spare you the very boring dev user login process, but now we can run kubectl development, get pods and if we try to do say Kube-system. We get access denied. So the first thing we want to do is create our access request. So if you want to do this automated look in script five in your get checkout of this course, but I will do it manually here. So you can see the process is really simple, doesn't take a lot of effort. We just want to create a request where we request the roles kube-admin. We can provide a reason I need to debug production for big client X, Y, Z.

6:36 And of course they got that the wrong way round. Requests create. All right, so our request has been created, A little bit control seat that just now we can run TSH requests Ls and we can see that that is pending. So what we're gonna give. It is just exec and to our teleport off service. This means I will need to use the context admin at production teleport, get pods And then we can use exec it, TCTL. Oh, and don't forget the pod name. Uh, exec. And what we want to do is approve, and if we run dash dash help on

7:37 this, tell is everything that we need to know to approve a request. So we just need to grab our request ID here like so. Let's see, so that's the TSH request. Ls. We can see that is approved. We can do a login request ID equals user dev user. And proxy dot rawkode.cloud. And we can see here that we now have our kube-admin rule. So if we do a cube login to our Teleport rawkode.cloud Cluster. And run, get pods and we'll see all name spaces. I'm not sure I had to run is moaning at me there, but we just ignored it.

8:40 We now have the ability to see every namespace pod inside of our Cluster. Via our elevated privileges with access requests. Now tell me that ain't awesome. Now, even though there is a short TTL of one hour, we can drop a request. Our privileges return to normal and the kube-admin rule disappears. That is teleport Access requests. There are a lot of features I love. Multiplex is one access, request is another. Go check it out. Have a whole lot of fun, and improve your security posture. Join us in the next video as we continue to explore the

9:26 awesome features of Teleport.

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.