WEBVTT

00:00:01.010 --> 00:00:08.450
All right, good morning, everyone. Yesterday we left off with Mongo 8 instead of Mongo 7.

00:00:09.010 --> 00:00:14.070
So when we were querying the logs, there were no logs.

00:00:14.690 --> 00:00:18.330
And so when I tested this, I tested it with Mongo 7.

00:00:19.570 --> 00:00:22.430
And I had not updated my repo.

00:00:23.190 --> 00:00:28.690
So I was on a slightly older version of the Helm chart, which had Mongo 7.

00:00:29.410 --> 00:00:37.330
and i did not pin it so even i make mistakes on that but i should always pin the version

00:00:37.330 --> 00:00:44.050
so now i went through and updated everything for mongo 8. you might find if you use mongo

00:00:44.770 --> 00:00:50.610
in production that some of the libraries aren't quite there yet for working with mongodb

00:00:50.610 --> 00:00:56.370
When I tested them in November, they still had some work to do.

00:00:57.390 --> 00:00:58.910
Tested Next.js.

00:00:59.590 --> 00:01:08.870
If you're familiar with the payload CMS, you can test out Next.js and Mongo and Minio together.

00:01:09.810 --> 00:01:15.650
And then FastAPI for Python to work with Mongo as well.

00:01:16.290 --> 00:01:23.090
so the libraries aren't completed yet for mongo version 8 which is 8.0

00:01:23.890 --> 00:01:29.730
it should be shorter so we went ahead and updated everything for mongo 8 and it works as intended so

00:01:29.730 --> 00:01:39.760
all right so your um yesterday your slide deck for seven should be updated with mongo 8. okay

00:01:39.760 --> 00:01:44.400
let's go ahead and get started and we're waiting on let's see i think we're waiting on john

00:01:44.400 --> 00:02:10.740
Sure. So today we'll be working with dashboards, metrics, logs, admin dashboards, and looking at JWTs that are generated in clusters.

00:02:10.740 --> 00:02:21.680
security, and automation.

00:02:23.380 --> 00:02:26.080
On Kubernetes security requires implementation

00:02:26.080 --> 00:02:27.860
of a multi-layered approach

00:02:27.860 --> 00:02:30.360
to address various components and resources.

00:02:30.360 --> 00:02:34.360
We have access control using a least privilege principle.

00:02:35.660 --> 00:02:37.940
Kubernetes allows role-based access control

00:02:37.940 --> 00:02:40.500
to restrict user and service account permissions.

00:02:41.680 --> 00:02:42.720
Secrets management,

00:02:43.460 --> 00:02:45.820
so you can securely manage your passwords,

00:02:46.140 --> 00:02:47.500
private keys, and certificates

00:02:47.500 --> 00:02:54.200
using Kubernetes secrets or extended secret management solutions such as Inphysical or Vault.

00:02:55.380 --> 00:03:01.680
And I've found that Inphysical has been replacing all clusters lately.

00:03:03.280 --> 00:03:07.540
Data security, protecting your data at rest and in transit.

00:03:08.240 --> 00:03:14.040
Persistent volume should be encrypted at the volume level and also, if you can, at the database level.

00:03:14.040 --> 00:03:21.400
and so at the database level you can encrypt it sometimes this requires an enterprise subscription

00:03:21.400 --> 00:03:30.520
but you can encrypt the values automatically you can also encrypt within your application itself

00:03:30.520 --> 00:03:35.640
when you store the values and read the values if that's not an option with node hardening

00:03:35.640 --> 00:03:41.800
nodes should be secured with key only access you should use proper hardening and enable node level

00:03:41.800 --> 00:03:48.760
firewalls to lock down any unused ports. For pod security, security standards such

00:03:48.760 --> 00:03:55.980
as pod security standards, PSS, or pod security policies, PSPs, should be used to

00:03:55.980 --> 00:04:00.280
restrict privileged containers and you probably won't run into too many

00:04:00.280 --> 00:04:05.800
privileged containers but when you do you should follow those practices. For

00:04:05.800 --> 00:04:10.480
your API server, the central point of access for the cluster should be

00:04:10.480 --> 00:04:17.760
secured to eliminate unauthorized or unauthenticated access. For role-based access control,

00:04:17.760 --> 00:04:23.760
RBAC enables regulation of user access to the cluster and its resources. Enabling RBAC

00:04:23.760 --> 00:04:30.160
requires that the Kube API server have an authorization configuration set to the RBAC

00:04:30.160 --> 00:04:38.560
type author. A role sets our permissions within a namespace. A cluster role sets our permissions

00:04:38.560 --> 00:04:50.260
cluster-wide and is non-namespace for a resource. The RBAC role contains rules that represent a set

00:04:50.260 --> 00:04:56.740
of permissions. There are no deny rules. The role sets permissions within a particular namespace.

00:04:57.300 --> 00:05:02.740
You must specify a namespace in the role. It is useful for restricting development teams to a

00:05:02.740 --> 00:05:09.060
dev namespace or restricting individual teams to their own application. Role binding grabs the

00:05:09.060 --> 00:05:14.040
permissions defined in a role to a user or a set of users. Role binding holds a

00:05:14.040 --> 00:05:19.020
list of subjects containing users, groups, or service accounts. And role binding can

00:05:19.020 --> 00:05:24.240
reference a cluster role and bind to a namespace. We have cluster role and

00:05:24.240 --> 00:05:29.560
cluster role binding. A cluster role contains rules that represent a set of

00:05:29.560 --> 00:05:34.160
permissions. There are no deny rules. Cluster roles are not bound to a single

00:05:34.160 --> 00:05:38.700
namespace. This is useful for cluster scoped resources like nodes, useful for

00:05:38.700 --> 00:05:44.060
enabling a user to get from all namespaces or hyphen capital A, and

00:05:44.060 --> 00:05:50.730
cluster role bindings used to grant permissions cluster-wide. For service

00:05:50.730 --> 00:05:55.730
accounts, when a pod authenticates with the Kube API server, they use a service

00:05:55.730 --> 00:06:01.230
account. Every Kubernetes namespace contains at least one service account.

00:06:01.230 --> 00:06:06.570
These may be abbreviated using the Kube control CLI as SA for service account. If

00:06:06.570 --> 00:06:12.150
If you do not specify a service account when creating a pod, Kubernetes will assign a default

00:06:12.150 --> 00:06:18.810
SA for a service account and pods assign a service account name at create.

00:06:18.810 --> 00:06:21.690
Oh, it looks like John is there.

00:06:21.690 --> 00:06:22.690
Good morning, John.

00:06:22.690 --> 00:06:23.690
That's all right.

00:06:23.690 --> 00:06:33.950
Go ahead and get your desktop set up and we're going through RBAC access tokens and service

00:06:33.950 --> 00:06:34.950
accounts.

00:06:34.950 --> 00:06:41.710
For API access tokens, a service account is used to generate a token request for the Kube

00:06:41.710 --> 00:06:44.030
API server.

00:06:44.030 --> 00:06:48.630
The token is auto-mounted in the pod using a projected volume.

00:06:48.630 --> 00:06:53.770
ConfigMap containing the cert authority data is also added.

00:06:53.770 --> 00:06:58.950
The service account admission controller adds the projected volume to the pod containing

00:06:58.950 --> 00:07:01.090
the service account token.

00:07:01.090 --> 00:07:07.150
account tokens have bounded lifetimes. The default equals one hour. The node

00:07:07.150 --> 00:07:11.610
kubelet handles the initial fetching and refreshing of the token and service

00:07:11.610 --> 00:07:16.930
account tokens are automatically invalidated upon pod deletion. And we'll

00:07:16.930 --> 00:07:24.650
be able to verify our service account token using a common tool that's

00:07:24.650 --> 00:07:30.330
available through the Internet. Security context defines privilege and access

00:07:30.330 --> 00:07:37.130
control settings for a pod or container. User ID, group ID, privilege, Linux capabilities,

00:07:37.130 --> 00:07:43.690
privilege escalation, read-only root file system, AppArmor, and SELinux are among the settings

00:07:43.690 --> 00:07:49.770
available. Pod-wide security context can be set in the pod spec security context. Individual

00:07:49.770 --> 00:07:59.520
container security context can be set in the pod spec containers security context. For resource

00:07:59.520 --> 00:08:05.680
quotas, they enable multiple teams to use a shared cluster without one team using more than a

00:08:05.680 --> 00:08:11.180
specific amount of resources. We can apply the same to an application. Resource quotas are bound

00:08:11.180 --> 00:08:17.340
to a specific namespace. Resource quota changes have no effect on already created resources.

00:08:17.560 --> 00:08:24.180
Resource quota delete or update access may be restricted by defining a validating admission

00:08:24.180 --> 00:08:31.000
policy. And if quotas are enabled in a namespace for CPU or memory, users must specify requests

00:08:31.000 --> 00:08:39.820
or limits for CPU or memory when creating a pod resource. Yeah, so you'd need to restart that or

00:08:39.820 --> 00:08:48.160
reinstall it. Correct. So it's going to look for the resource quota when it goes to start it up,

00:08:48.160 --> 00:08:54.400
schedule it and kubelet will say okay i need x amount of resources and when it's assigned to

00:08:54.400 --> 00:09:03.200
that node um so scheduler needs to know are you limited um do we have the resources available on

00:09:03.200 --> 00:09:09.920
that so it takes place in advance if there are no resource quotas um and if you were to apply

00:09:09.920 --> 00:09:15.680
that after the fact without restarting it wouldn't have any effect but we can just reinstall it but

00:09:15.680 --> 00:09:18.500
But we would need to reinstall everything in that namespace.

00:09:20.060 --> 00:09:25.700
Yeah, or if, let's say that your team has a scheduled rollout of updated clusters,

00:09:26.380 --> 00:09:31.820
then you could put that on your sprint to, okay, we're not quite ready maybe to do resource quotas yet on everything,

00:09:31.820 --> 00:09:36.460
but on our next sprint in three months, we'll have resource quotas on everything.

00:09:36.860 --> 00:09:38.820
So you can do it that way as well.

00:09:41.010 --> 00:09:43.210
It doesn't break the continuity of the framework.

00:09:44.210 --> 00:09:45.490
Okay, network policy.

00:09:45.490 --> 00:09:54.530
Network policies enable traffic flow at the IP address or port level for TCP, UDP, and SCTP protocols.

00:09:54.650 --> 00:09:58.890
Network policies are implemented by a network plug-in, such as CILIUM.

00:10:00.770 --> 00:10:03.790
The network plug-in chosen must support network policies.

00:10:03.910 --> 00:10:10.510
The default network policy is to allow all ingress and egress to and from pods in a particular namespace.

00:10:10.510 --> 00:10:16.350
Network policies that limit port access may need to be updated when updating your container.

00:10:16.990 --> 00:10:23.630
So if you update your container, for example, you're limiting a port access.

00:10:25.310 --> 00:10:30.030
It's the same way with a firewall. What you'll find is that the upstream teams

00:10:30.030 --> 00:10:36.350
will change the ports. It seems kind of inconvenient, but oftentimes they don't

00:10:36.350 --> 00:10:42.430
even know that they changed the ports. It might sound a little odd, but I've had to remind upstream

00:10:42.430 --> 00:10:48.670
teams several times that they've changed the ports and they had a back and forth where they didn't

00:10:48.670 --> 00:10:53.790
even think that anything had changed. I was able to demonstrate to them that the containers were

00:10:53.790 --> 00:11:00.110
using totally different ports now. So it's probably something that upstream teams should

00:11:00.110 --> 00:11:08.990
keep more track of and provide the port listing in their documentation. For data security,

00:11:08.990 --> 00:11:16.590
data should be encrypted in transit using the latest TLS protocols. Kubernetes offers both a

00:11:16.590 --> 00:11:23.950
modern gateway API and a legacy ingress API to encrypt traffic in transit. For volume encryption,

00:11:23.950 --> 00:11:30.670
modern Kubernetes block storage offers volume encryption for dynamically generated persistent

00:11:30.670 --> 00:11:36.430
volumes. For database encryption, Kubernetes database resources may also offer key-value

00:11:36.430 --> 00:11:41.870
pair encryption for data at rest. So some of them will encrypt both the key and the value,

00:11:41.870 --> 00:11:47.390
some will just encrypt the value. In secrets encryption, the etcd database should have

00:11:47.390 --> 00:11:53.790
encryption enabled for secret key-value pairs along with encryption entrant. All right,

00:11:53.790 --> 00:11:58.750
now we move to automation. Modern Kubernetes clusters are created with infrastructure as

00:11:58.750 --> 00:12:06.750
code or IAC as opposed to building them manually with kubeadmin using a certified kubernetes

00:12:06.750 --> 00:12:12.590
administrator. If you use a kubeadmin approach which is the older method from the cloud days

00:12:13.550 --> 00:12:22.090
generally requires a full-time kubernetes engineer to manage it. IAC enables a fully automated

00:12:22.090 --> 00:12:27.610
deployment to be implemented in development staging and production environments and some

00:12:27.610 --> 00:12:35.210
teams rename those to test development and production so it just depends on how you want your

00:12:36.650 --> 00:12:44.890
your environment set up or named terraform is often used to provision the underlying vm or vps

00:12:44.890 --> 00:12:50.730
resource along with networking resources and ansible is adapted well for configuration

00:12:50.730 --> 00:12:57.050
management tasks such as provisioning the desired kubernetes distribution and core components along

00:12:57.050 --> 00:13:04.490
with the CNI, the network interface, the CSI, the storage interface, and your CI CD resources.

00:13:04.490 --> 00:13:10.570
Automation deployments require short-term privileged access during the creation phase.

00:13:12.490 --> 00:13:19.050
It is generally a good practice to remove the short-term privileged access after the cluster

00:13:19.050 --> 00:13:24.010
has been created or restrict it to a particular VM. Automation deployments also require the ability

00:13:24.010 --> 00:13:29.610
to automate container and helm chart resource creation along with version control. This is

00:13:29.610 --> 00:13:37.370
typically performed to continuous integration or CI process. Custom containers and helm charts are

00:13:37.370 --> 00:13:44.010
stored in private container registries and private helm chart package registry. Continuous delivery

00:13:44.010 --> 00:13:50.970
or CD along with declarative GitOps enables application resource state management

00:13:51.770 --> 00:13:57.530
With real-time updates, declarative GitOps enables the automated application resource

00:13:57.530 --> 00:14:03.930
deployment to the Kubernetes cluster with the ability to roll back to a prior working

00:14:03.930 --> 00:14:10.890
version if any issues arise during an upgrade. This can be implemented during the automated

00:14:10.890 --> 00:14:19.560
cluster start process. Upgrading versions of a workload or database application is fairly

00:14:19.560 --> 00:14:27.720
straightforward. Test the new version in a test cluster. Push the new values.yaml file and version

00:14:27.720 --> 00:14:34.840
to a Git repo. The declarative GitOps resource will read the new state requested. The declarative

00:14:34.840 --> 00:14:43.560
GitOps will then sync the new state requested and it uses Helm to inflate that. If the upgrade fails,

00:14:43.560 --> 00:14:48.520
you can set it to sync with the previous version. You simply change the version, push it to your

00:14:48.520 --> 00:14:55.240
Git repo and a declarative GitOps, such as Argo, will automatically read that and roll it back to

00:14:55.240 --> 00:15:01.400
the previous state. And this is similar to what it would look like inside of Argo with the declarative

00:15:01.400 --> 00:15:07.720
GitOps. In this case, it's kubeprom stack and you can see how it lists out the resources.

00:15:08.440 --> 00:15:14.920
If any of them fail or having issues, they'll oftentimes have a broken heart. You'll see a red

00:15:14.920 --> 00:15:20.800
symbol and you can click on it and you can see if logs are available. You can

00:15:20.800 --> 00:15:24.820
read the logs. If events are available, you can read the events just by selecting

00:15:24.820 --> 00:15:30.100
the resource that is available. It brings an entirely new approach to

00:15:30.100 --> 00:15:35.680
running your applications on a Kubernetes cluster. Instead of using the CLI, we

00:15:35.680 --> 00:15:43.220
can actually have a very nice UI to check on our application. This also can

00:15:43.220 --> 00:15:51.460
assist when you are starting it up in development so you can use Argo in development if your team

00:15:51.460 --> 00:15:58.420
is not that well versed in Kubernetes just having a visual layout of what is going wrong

00:16:00.340 --> 00:16:06.100
can save you valuable time right to get right into the labs we're going to create a service account

00:16:06.100 --> 00:16:16.380
If you go to the gitlab.com, automatedk8s, digress, k8s4dbasic2advanced, you should see

00:16:16.380 --> 00:16:24.860
a new lesson 8 and particularly we're going to look for our serviceaccount.yaml so we

00:16:24.860 --> 00:16:31.360
need to pull that in and when you're ready go ahead and ensure a fresh Minikube environment

00:16:31.360 --> 00:16:39.680
start a single node minikube and make sure that your serviceaccount.yaml

00:16:41.360 --> 00:19:11.250
matches what you see on the screen and go ahead and apply it. Yeah if you're in the k8s4day basic

00:19:11.250 --> 00:19:16.850
to advanced folder you should be able to run git pull origin inside that folder that you

00:19:16.850 --> 00:20:40.050
have to stash before you make any modifications or brought any new files in. That's what Stanley does

00:20:41.010 --> 00:22:03.330
right? Double and. Ask Stanley. Yeah. And then once you apply that service account,

00:22:04.690 --> 00:22:12.930
we are going to verify the service account. This is one of them that we can't abbreviate.

00:22:27.840 --> 00:22:34.980
Yeah. So unfortunately, we can't do that with every resource, but with service account,

00:22:34.980 --> 00:22:43.730
we can. Services, service account. I wish we could abbreviate everything but some of the

00:22:44.370 --> 00:22:59.190
resources we type in are quite long. It's good practice to put it in there so

00:23:03.560 --> 00:23:35.880
you can leave it out for default but it's always good practice to include it in there. Students

00:23:35.880 --> 00:23:42.760
oftentimes take the code and use it in their own with a different namespace so I've set it up so

00:23:42.760 --> 00:23:54.340
that you can just change the namespace to whatever you want. All right does everyone apply? It looks

00:23:54.340 --> 00:24:03.410
good all right and so now we're going to create a role so look in that folder for role.yml

00:24:04.530 --> 00:24:11.940
make sure it matches what you see here it does you can go ahead and apply it once you apply it

00:24:11.940 --> 00:24:19.780
we will get the roles okay now we're going to bind the role to a service account you should

00:24:19.780 --> 00:24:26.820
see a role binding.yml and make sure that it matches what is on the screen are you going

00:24:26.820 --> 00:24:32.100
gonna roll dot binding or roll dash binding? I'll do roll dash binding. I do it

00:24:32.100 --> 00:24:36.060
all the time. No worries Ralph. That's just part of

00:24:36.060 --> 00:24:41.580
working with the command line. There'll be a file later today after lunch that

00:24:41.580 --> 00:24:45.900
you'll get a kick out of. It's a file that you would probably do that with.

00:24:45.900 --> 00:24:52.580
We'd all do that with. Go ahead and apply it and then verify the roll binding. Now

00:24:52.580 --> 00:24:59.860
We're going to create a user with the kube api server token.

00:24:59.860 --> 00:25:06.800
So we're going to create an API server token using a token request, kubectl create token.

00:25:06.800 --> 00:25:09.540
What was our essay name?

00:25:09.540 --> 00:25:10.540
And what was our namespace?

00:25:10.540 --> 00:25:11.540
Dev-user.

00:25:11.540 --> 00:25:18.280
And if you open your browser and go to jwt.io, you're going to copy that entire JWT, which

00:25:18.280 --> 00:25:22.100
starts with an EY and ends in, what does it end with?

00:25:22.100 --> 00:25:25.520
Does anyone know can't read your screen and everyone's good.

00:25:26.300 --> 00:25:26.780
Love it.

00:25:27.440 --> 00:25:28.120
Uh, yeah.

00:25:28.120 --> 00:25:30.740
So it starts with the UI and goes to whatever yours ends with.

00:25:30.740 --> 00:25:37.220
So, and you'll copy that and you'll clear, you'll go to jwp.io and you'll

00:25:37.220 --> 00:25:39.020
clear out what's already in there.

00:25:39.380 --> 00:25:43.220
There's a demonstration and then paste, you just copy it, the clear button.

00:25:43.220 --> 00:25:46.040
And well, that's annoying except cookie.

00:25:46.040 --> 00:25:49.860
You can see that it is issued for the cluster.

00:25:49.880 --> 00:25:51.420
We know that it's correct.

00:25:51.420 --> 00:25:56.380
So now we can create a variable with a new API server token using token request.

00:25:57.100 --> 00:26:01.660
So we're going to do the same thing but I'll put it to a variable for token.

00:26:07.390 --> 00:26:10.110
Yeah, oh no, you're missing something.

00:26:10.110 --> 00:26:11.550
You're missing a, there you go.

00:26:12.670 --> 00:26:18.670
All right, so now we're going to set up the minigail.

00:26:18.670 --> 00:26:20.910
We're going to set up our minicube context for the

00:26:20.910 --> 00:26:28.430
set credentials dev user and our token which is a double hyphen in front of that

00:26:28.430 --> 00:26:35.310
token equals dollar capital token and once we have that done we're going to do the next command

00:26:35.310 --> 00:26:43.150
which is we're going to set our context to our dev user context and our user is dead and once

00:26:43.150 --> 00:26:50.430
that is done we have a third command where we will use our context dev user context and once

00:26:50.430 --> 00:27:00.190
Once we've done that, we are going to verify kubectl config, git context, and locate the

00:27:00.190 --> 00:27:07.930
kubectl config file in the minikubectl cluster and obtain the client server, cd.kubectl.catter.config.

00:27:07.930 --> 00:27:10.190
Did you cd into .kubectl?

00:27:10.190 --> 00:27:12.590
Oh, yes.

00:27:12.590 --> 00:27:17.870
So that's because you are not in root, so you'd have to go to root.

00:27:17.870 --> 00:27:20.370
So you need something in front of the kubectl.

00:27:20.370 --> 00:27:26.910
need a forward slash, I believe, in front of the dot for kube. If you're in your

00:27:26.910 --> 00:27:33.130
group you can just do cd.kube. Alright, then we can cat our config. Alright, so now

00:27:33.130 --> 00:27:37.470
we're gonna create an nginx pod for testing. It's just simple command, no

00:27:37.470 --> 00:27:44.690
yaml. Let's just run nginx pod and then our image. We're gonna tell it to run nginx

00:27:44.690 --> 00:27:51.890
the latest whatever the latest is so yeah so we don't have the ability to run a pod so let's

00:27:51.890 --> 00:28:00.210
check something else here let's test dev user again and for default let's get the pods in the

00:28:00.210 --> 00:28:19.440
default name space yeah and then let's try to read all of the pods so this is a great way to restrict

00:28:19.440 --> 00:28:25.920
down access for users so that they can't just create resources

00:28:28.400 --> 00:28:33.680
or in this case this is a pod reader remember we set up a service account for a pod reader

00:28:33.680 --> 00:28:40.800
we created a role for a pod reader so that is our role and so it can only read pods it can't

00:28:40.800 --> 00:28:47.360
start pods or run pods and it can only read pods in its own namespace so it cannot read pods outside

00:28:47.360 --> 00:28:51.600
So only one of these commands should work, which is git pods in the default namespace.

00:28:51.600 --> 00:28:54.400
You can see how RBAC works really well here.

00:28:55.440 --> 00:28:58.640
And now we're going to verify and change context.

00:28:59.200 --> 00:29:02.880
kubectl config git context again.

00:29:02.880 --> 00:29:04.400
I'm going to change it back to minikube.

00:29:04.400 --> 00:29:08.640
And you should be able to view all namespaces.

00:29:08.640 --> 00:29:11.600
So kubectl git pods hyphen a should work.

00:29:11.600 --> 00:29:12.800
You could run that pod again.

00:29:13.360 --> 00:29:15.280
So we could go back to here.

00:29:15.280 --> 00:29:33.150
and you could to control run nginx pod image nginx latest yep i see an nginx pod running

00:29:35.150 --> 00:29:46.100
and we should be able to run all three of these commands delete that nginx

00:29:47.540 --> 00:29:53.620
what's that we should be able to delete the nginx pod now delete and in this case we don't need to

00:29:53.620 --> 00:29:59.460
delete hyphen f file name dot yaml so there are two ways to delete so we can delete the pod

00:29:59.460 --> 00:30:05.460
nginx.pod if we're used a file for it we can delete it using the file name and we can delete

00:30:05.460 --> 00:30:13.540
our context dev user context and we can delete our user correct because we didn't actually use

00:30:13.540 --> 00:30:19.140
the file name so i'm showing there's two ways that you can delete if you had used the file name

00:30:19.140 --> 00:30:26.140
We can just delete the pod using the kubectl command, or we can delete based on the file name.

00:30:26.140 --> 00:30:30.140
In this case, we didn't use a file name to create it. I don't believe so.

00:30:30.140 --> 00:30:33.140
Maybe we can just delete it because we're using kubectl.

00:30:33.140 --> 00:30:37.140
If you run the first one, then I'm not going to be able to delete that.

00:30:37.140 --> 00:30:42.140
Verify the dev user context and the dev user was deleted from the kubectl config.

00:30:42.140 --> 00:30:44.140
The token is gone.

00:30:44.140 --> 00:30:48.140
All right. We should be able to check our context. Available on minikube.

00:30:48.140 --> 00:30:51.900
And we just have one context shown, if everything was successful.

00:30:51.920 --> 00:30:52.220
All right.

00:30:52.220 --> 00:30:55.940
So now we have an exercise for you.

00:30:58.670 --> 00:31:00.050
This is a team exercise.

00:31:04.730 --> 00:31:09.470
A few of the commands, but as usual, I've left one or two commands.

00:31:09.610 --> 00:31:16.070
Once you have a Minikube three node cluster up and running, you need to

00:31:16.070 --> 00:31:23.470
install the PSMDB operator and the PSMDB database that we practiced yesterday.

00:31:23.470 --> 00:31:30.990
should be the latest and version 8 of Mongo that should already be set up in your directory.

00:31:31.950 --> 00:31:38.190
So wherever you have your values.yaml file where you created this, that would be your root folder,

00:31:38.750 --> 00:31:45.550
your home folder. We're going to spin up the operator and then spin up the database

00:31:45.550 --> 00:31:52.670
and then create a service account, role binding, and token. And then you create a context

00:31:52.670 --> 00:32:00.590
and test the RBAC for the MongoDB user. So that's an odd reader. It could be something else. You can

00:32:00.590 --> 00:32:09.070
use something else instead of dev user. It could be MDV user. You can be as creative as you want.

00:32:09.950 --> 00:32:16.750
And then after you've demonstrated that, you can delete the resources when you're complete. And

00:32:16.750 --> 00:32:21.790
the errors that we see when we try to use HelmInstall are because this version of Minipoob

00:32:21.790 --> 00:32:34.190
is using kubernetes 1.34.0 and .0 has a little error in it that they have fixed in 1.34.1

00:32:34.190 --> 00:32:42.030
so again one of the many reasons that they don't install the .0s for the .1s in production okay so

00:32:42.030 --> 00:32:49.870
that error there that you see about the integer 32 integer 64 that is an error from kubernetes

00:32:49.870 --> 00:32:56.990
one dot three four dot zero and feel free to turn on your mics and communicate if you run into issues

00:32:56.990 --> 00:33:02.270
incorrect looks like you all did well well when you do minicoop stop minicoop delete all i think

00:33:02.270 --> 00:33:09.630
it'll wipe that kube config file out but yeah i think so and go ahead and wipe your minicoop

00:33:09.630 --> 00:33:13.950
profile out and while you're doing that i'll go ahead and do the lesson review and we'll take a

00:33:13.950 --> 00:33:21.950
two-minute break. In lesson eight we learned how kubernetes security works, how service accounts

00:33:21.950 --> 00:33:30.990
work with a token for kube api access, how roles grant permissions to users, how role bindings

00:33:30.990 --> 00:33:40.030
assign roles to service accounts, how to create a user context, how to change a user context,

00:33:40.030 --> 00:33:48.750
Plus you, how context and users are added to the kubeconfig file, what goes into a token

00:33:48.750 --> 00:33:58.370
for kubeapi access, reviewed at jwt.io, how production environments use kubeconfig files,

00:33:58.370 --> 00:34:04.650
why enabling data at rest encryption for secrets is important, and different types of data

00:34:04.650 --> 00:34:12.250
at-rest encryption for volumes. So go ahead and take a two-minute break. When we come back we'll start into lesson 3.
