WEBVTT

00:00:02.830 --> 00:00:06.830
Let's see, where were we?

00:00:06.830 --> 00:00:08.830
All right, we were on slide 68.

00:00:08.830 --> 00:00:14.270
All right, so we had everyone's in.

00:00:14.270 --> 00:00:16.270
So everyone logged in.

00:00:16.270 --> 00:00:19.270
Okay, so now we're going to go to Dashboards.

00:00:19.270 --> 00:00:21.270
We're going to add a new dashboard for Node Explorer.

00:00:21.270 --> 00:00:26.270
And in Home Dashboards, select the New button in the upper right corner.

00:00:26.270 --> 00:00:27.270
Go to Home Dashboards.

00:00:27.270 --> 00:00:30.270
You'll see a Dashboards on the left.

00:00:31.150 --> 00:00:36.510
and in the upper right corner select the new button and find the new button and from the

00:00:36.510 --> 00:00:50.900
drop down menu select import i should be a new button see if i can show you so you go to to

00:00:50.900 --> 00:01:05.710
dashboards and then see the new button right here hit new and then import hang on this a second i

00:01:05.710 --> 00:01:17.520
get i'm freezing up yeah okay home dashboard select the new button and then from the drop

00:01:17.520 --> 00:01:25.600
down menu select import and then input id 1860 and select load so it's on the same line as load

00:01:25.600 --> 00:01:31.200
in the middle of the page type 1860 and then hit the load button and select the prometheus data

00:01:31.200 --> 00:01:37.840
source which is prometheus so select the data source download lower now download oh yeah did

00:01:37.840 --> 00:01:48.910
you hit import uh no so after you hit load uh you're gonna here let me show you 1860. 1860

00:01:48.910 --> 00:02:04.950
and then we hit load and now we go down here to we hit import there's one I

00:02:04.950 --> 00:02:11.830
already have that one in mind so I don't have the ability to select the data

00:02:11.830 --> 00:02:24.340
source we're going to catch up to it okay so now we're going to add a new

00:02:24.340 --> 00:02:29.860
dashboard for core DNS so do the same thing select new button in the upper

00:02:29.860 --> 00:02:37.980
right corner, select import, and you're going to use an input ID of 14981, select load, but we're

00:02:37.980 --> 00:02:44.480
going to rename it afterwards to core DNS 2, because we already have a core DNS in there.

00:02:45.640 --> 00:02:51.720
So this is a way to create two dashboards of the same thing. You may want to modify one,

00:02:51.880 --> 00:02:58.320
but leave the other. In this case, we'll select Prometheus data source, Prometheus, and import.

00:02:59.860 --> 00:03:06.180
Yeah, I see the Prometheus. John, how about everybody else? Does everyone else have Prometheus?

00:03:06.480 --> 00:03:12.640
Yeah, weird. Is your Prometheus running? It's weird that you don't have a Prometheus data source.

00:03:12.740 --> 00:03:20.700
Everyone else should. I don't have any Prometheus data. Weird. You must have something. There's one

00:03:20.700 --> 00:03:27.160
thing that's probably incorrect in your Helm YAMLs file, Helm values file. I had one thing

00:03:27.160 --> 00:03:31.880
it was incorrect did you have any errors when you loaded it do you have any errors let's see here

00:03:33.000 --> 00:03:40.360
uh yeah those are the kubernetes 1.34.0 but um yeah i don't see any errors here but under prometheus

00:03:40.920 --> 00:03:48.520
you probably have a an error related to the service monitor so if you remember i had you

00:03:48.520 --> 00:03:54.200
type in down towards the bottom these really long strings and those relate to the service monitor

00:03:54.200 --> 00:04:01.080
in the CRD. So you're not pulling any data. Probably one character was incorrect on there.

00:04:04.280 --> 00:04:07.400
And so you're not going to have any Prometheus data. Sorry about that.

00:04:08.360 --> 00:04:15.960
And everyone else has Prometheus data. Okay. Oh yeah. So you, so Prometheus enabled. Yeah.

00:04:15.960 --> 00:04:28.920
Let's see here. Want me to go back to that one? Okay. Let me go back to that. See what I was

00:04:28.920 --> 00:04:35.720
saying about how this one character will get you almost half of the errors on kubernetes

00:04:35.720 --> 00:04:44.560
there we go right here something in there is incorrect does someone want to copy and paste

00:04:44.560 --> 00:04:49.840
into the uh i don't know if that'll actually look can you copy and paste that into the chat

00:04:50.720 --> 00:04:55.360
ralph or ryan that has one i have to uninstall and reinstall making sure you

00:04:55.360 --> 00:04:58.960
you reference the correct file with the number two.

00:04:58.960 --> 00:05:01.100
If you don't have the number two in the file name,

00:05:01.100 --> 00:05:05.600
then it will use the name values.yaml.

00:05:05.600 --> 00:05:07.260
Stanley, you have the node ports, right?

00:05:07.260 --> 00:05:08.180
There's something in there.

00:05:08.180 --> 00:05:12.160
Not allow the Prometheus data source,

00:05:12.160 --> 00:05:13.820
which is under Prometheus.

00:05:17.410 --> 00:05:23.820
And you uninstall and reinstall.

00:05:23.820 --> 00:05:26.820
Oh yeah, and then you'll need the password again.

00:05:26.820 --> 00:05:29.020
If you uninstall, it'll probably delete the secret

00:05:29.020 --> 00:05:30.340
and recreate a new password.

00:05:30.340 --> 00:05:36.760
you need to run kubectl get secret. Some of those won't have data, but click on

00:05:36.760 --> 00:05:42.900
core DNS that should have data. That's bizarre. Is everything running? Let's see here.

00:05:42.900 --> 00:05:49.540
We put that in the monitoring namespace. I bet if we minikube stop, minikube delete all,

00:05:49.540 --> 00:05:54.820
create and recreate everything from scratch, it would probably work. There's something that when you

00:05:54.820 --> 00:05:59.080
installed the first time and you had to go back to it in both of them, you'd have to change your

00:05:59.080 --> 00:06:04.460
the YAML files. Oh, you know what? Uninstall. So what it did is it probably created service

00:06:04.460 --> 00:06:09.520
monitors incorrectly when you installed it the first time. And you probably have incorrect

00:06:09.520 --> 00:06:13.600
service monitors. We don't have enough time to troubleshoot that, but that would be my guess

00:06:13.600 --> 00:06:19.560
because it was installed incorrectly the very first time. And so even though you have services

00:06:19.560 --> 00:06:25.400
now with NodeForks, the service monitors that collect the metrics data were installed incorrectly

00:06:25.400 --> 00:06:30.280
and they're not being deleted with Helm or we didn't wait long enough when we Helm uninstalled

00:06:31.240 --> 00:06:36.200
for it to uninstall the service monitors. But that would be my guess is your service monitors

00:06:36.200 --> 00:06:41.320
are incorrectly installed. If we were to troubleshoot that that's probably what we'd find.

00:06:41.320 --> 00:06:48.520
Okay so but we can see we can add a few more so it's core DNS another one Kubernetes views

00:06:48.520 --> 00:06:59.550
Yeah, this is a nice one here.

00:06:59.550 --> 00:07:06.710
I think you'll find this one useful, um, well, sorry Stanley and John, but, uh, I could

00:07:06.710 --> 00:07:23.040
probably show you one of mine, that's gonna be, this is Node Explorer full, another dashboard

00:07:23.040 --> 00:07:32.090
global, use global, so this is the one that we just installed right now, so fairly useful,

00:07:32.090 --> 00:07:47.120
shows our global CPU usage, global RAM. Did everyone get that installed? Prometheus data source.

00:07:47.120 --> 00:07:57.000
Yeah, nice. That one's pretty useful. And then let's do the next one, which is MongoDB,

00:07:57.960 --> 00:08:09.120
home dashboards, new, ID 20867. Select load, select Prometheus data source,

00:08:09.120 --> 00:08:17.240
and import and what do we have no data and that's because although we do have mongo up and running

00:08:17.240 --> 00:08:24.280
remember when i talked about sidecars we have to uh create a sidecar uh for that to grab those

00:08:24.280 --> 00:08:30.900
metrics and then you'll see data there so that's where the sidecar comes in so um

00:08:30.900 --> 00:08:38.560
now if we uninstall none of these charts are going to persist we have to reinstall them every

00:08:38.560 --> 00:08:46.000
time. So we do have a method of persisting them. So we can add this to our values.yaml file.

00:08:46.380 --> 00:08:51.920
And what it is, I'll go to the next slide. What we're adding under Grafana is our dashboard

00:08:51.920 --> 00:09:07.560
providers. Sorry about that. I did it myself. Yeah. So what you'll see is if we were to uninstall

00:09:07.560 --> 00:09:13.560
and reinstall we would lose all of our charts so we can persist these these charts the dashboards

00:09:13.560 --> 00:09:18.280
by going back to our where we had grafana enabled service node port and we don't have to do that

00:09:18.280 --> 00:09:25.560
right now but we simply add a dashboard provider and we provide our grafana dashboards and then

00:09:25.560 --> 00:09:32.920
down here for example mongodb replica set and this would enable it to persist uh when we uninstall

00:09:32.920 --> 00:09:38.200
helm or reinstall helm that way we don't lose our dashboards we can also use a config map file

00:09:39.240 --> 00:09:45.200
in a json format for that and let's see there's one other thing i want to show you

00:09:46.240 --> 00:09:53.520
because we're almost out of time here but i wanted to talk about sidecars so and we do have service

00:09:53.520 --> 00:10:00.000
monitors here for mongo to enable us to collect them with the sidecar all right so let me go to

00:10:00.000 --> 00:10:11.900
So this is about installing a service monitor for Mongo, and those files are in your lesson

00:10:11.900 --> 00:10:12.900
nine.

00:10:12.900 --> 00:10:19.480
So when you go through this, they're already typed out when you go to the PDFs.

00:10:19.480 --> 00:10:27.600
So as an example, the MongoDB server ships metrics to Percona's server, which is overseas

00:10:27.600 --> 00:10:28.600
in a foreign country.

00:10:28.600 --> 00:10:31.540
Now, I don't know about you, but I don't like giving somebody my metrics.

00:10:31.540 --> 00:10:38.260
and server information. So I intercept those metrics and I ship the metrics to Prometheus

00:10:38.820 --> 00:10:43.540
and I do so I use a sidecar with a metrics endpoint to accomplish this task.

00:10:44.420 --> 00:10:51.300
So we already created a user which is the Mongo Express admin user to access

00:10:52.820 --> 00:11:00.580
MongoDB and it also is able to access the MongoDB metrics as well. So in production a new metrics

00:11:00.580 --> 00:11:05.800
user should be created with specific limited roles. But in this case, in the

00:11:05.800 --> 00:11:11.260
interest of time, we created a single user with both roles. Okay, so what is a

00:11:11.260 --> 00:11:16.640
sidecar? Well, it's pretty descriptive. We have a primary container, right? And then

00:11:16.640 --> 00:11:21.320
we attach a container to it, just like a sidecar on a motorcycle. So the sidecar

00:11:21.320 --> 00:11:26.340
by itself does nothing. So it doesn't run on its own. It's designed to be attached

00:11:26.340 --> 00:11:32.940
to a specific container for a specific purpose. So kind of self-explanatory there.

00:11:32.940 --> 00:11:39.060
A sidecar is a secondary container that runs alongside a primary container. It

00:11:39.060 --> 00:11:45.100
runs inside the same pod as a primary container. And after install, the second

00:11:45.100 --> 00:11:49.080
number in the pod ready state will increment by one. So if anyone has their

00:11:49.080 --> 00:11:59.240
pods up and they have the mongodb so if you were to type kubectl get pods namespace mongodb then

00:11:59.240 --> 00:12:07.080
where you see mongodb psmdb and it says three of three ready so those would change to four of four

00:12:07.080 --> 00:12:13.080
once we add a sidecar because we'd be adding a container within that pod and that container's

00:12:13.080 --> 00:12:20.520
purpose is just to grab the metrics from each of these MongoDB instances, right? So it's going to

00:12:20.520 --> 00:12:26.160
increment by one. So instead of ready three of three, it'd be ready four of four, unless the

00:12:26.160 --> 00:12:33.260
sidecar fails, in which case it would be ready three of four, right? So a sidecar will also be

00:12:33.260 --> 00:12:38.620
listed when describing the pod. So when we add a sidecar to that, if you were to describe one of

00:12:38.620 --> 00:12:44.300
those MongoDB pods, it would be listed at the bottom as a sidecar.

00:12:44.300 --> 00:12:49.220
And logs may be read for a sidecar using its name along with the container flag.

00:12:49.220 --> 00:12:54.000
So if we just wanted to get the logs from the sidecar itself to debug, we would use

00:12:54.000 --> 00:12:58.920
the hyphen C, which is what Stanley asked me about yesterday, that we'd use the hyphen

00:12:58.920 --> 00:13:01.860
C and then the name of the sidecar or container.

00:13:01.860 --> 00:13:07.380
And that would allow us to see the logs within that sidecar for metrics purposes.

00:13:07.380 --> 00:13:16.040
so it looked like this to control logs and then the pod name the namespace and

00:13:16.040 --> 00:13:23.600
the hyphen C and then the sidecar name okay and if we were going to keep going

00:13:23.600 --> 00:13:28.700
this is what we would need to do to enable metrics using the sidecar so you

00:13:28.700 --> 00:13:35.600
can see that in the PSM DB DB home values that yellow file we do have an

00:13:35.600 --> 00:13:40.880
area for sidecars. So here's an area that's commented out for sidecars and we would add

00:13:40.880 --> 00:13:46.880
our sidecars with our image. So in this case we're adding a MongoDB exporter version 44

00:13:46.880 --> 00:13:53.260
and the name is metrics. So when we get our logs it would be hyphen c metrics because that's the

00:13:53.260 --> 00:13:58.100
name of the container running as a sidecar. We give it an env. This is very descriptive.

00:13:58.880 --> 00:14:03.900
We list out our password so that you can see that it's the same but in production we would not do

00:14:03.900 --> 00:14:12.060
this. So this is our MongoDB URI that we're feeding to the exporter. This is

00:14:12.060 --> 00:14:16.860
our connection stream, and then these are the arguments telling it to collect all

00:14:16.860 --> 00:14:22.380
of these metrics, right? And then after we collect those metrics, then we would

00:14:22.380 --> 00:14:29.880
ship those through the service monitor and the service that we create, which are

00:14:29.880 --> 00:14:37.320
in your lesson nine folder so you'll see a service mongodb psmdb dbmetrix service and it would show

00:14:37.320 --> 00:14:46.200
up under kubectl get service get svc and then we need a service monitor for kubeprometheus stack

00:14:47.480 --> 00:14:54.200
so that would be a little further down here actually it's a little further up so um

00:14:54.200 --> 00:14:56.840
using a service monitor.

00:14:57.060 --> 00:14:58.540
So let me see if I can show you this.

00:14:58.740 --> 00:14:59.340
Slide 81.

00:14:59.660 --> 00:15:01.240
I know we're about out of time here.

00:15:02.340 --> 00:15:04.460
So I want to stick around for just a couple more minutes

00:15:04.460 --> 00:15:05.560
and I'll show this to you.

00:15:13.260 --> 00:15:15.460
So this is your service monitor.

00:15:16.160 --> 00:15:17.840
So you know what a service looks like.

00:15:17.840 --> 00:15:19.540
And then for a good Prometheus stack,

00:15:19.620 --> 00:15:21.220
we create a service monitor.

00:15:22.780 --> 00:15:25.460
And so the service monitor allows Prometheus

00:15:25.460 --> 00:15:29.020
to have a data source and collect the metrics

00:15:29.020 --> 00:15:30.920
from the MongoDB service.

00:15:30.920 --> 00:15:35.880
And so this is what we would install. We have a sidecar, it's shipping the metrics,

00:15:35.880 --> 00:15:41.000
we have a service, we have a service monitor, and everything gets shipped to Prometheus.

00:15:41.720 --> 00:15:48.440
And then the Prometheus lists that out as a data source so that when we go to our MongoDB dashboard

00:15:48.440 --> 00:15:54.360
instead of what you saw there, which was no data, now the data is going to flow from that sidecar

00:15:55.080 --> 00:15:59.960
through the service, through the service monitor, to Prometheus and be listed as a data source.

00:16:00.920 --> 00:16:07.920
So, that was the last step here that we didn't quite get to.

00:16:07.920 --> 00:16:12.920
Okay, any questions about what we installed today?

00:16:12.920 --> 00:16:14.920
That was pretty fast-paced.

00:16:14.920 --> 00:16:16.920
It's kind of where everything comes together.

00:16:16.920 --> 00:16:20.920
Yeah, so it's kind of where everything comes together.

00:16:20.920 --> 00:16:25.920
So you do have the PDFs, and you do have the files,

00:16:25.920 --> 00:16:28.480
and you can spin up a Minikube instance.

00:16:30.720 --> 00:16:34.480
But when you install the service monitor manually with the sidecar,

00:16:35.200 --> 00:16:38.800
then you can kind of see as you're installing it how it flows through.

00:16:39.760 --> 00:16:44.320
And with that chart being up, then once you install the service monitor,

00:16:44.320 --> 00:16:47.040
all of a sudden that chart becomes populated with your data.

00:16:47.040 --> 00:16:52.000
So you can see how it flows through to the Prometheus data source.

00:16:52.000 --> 00:16:58.440
so um any questions yeah yes yeah i'll i usually leave that up for about a month

00:16:58.440 --> 00:17:04.260
so plenty of time in case you lose it you can go in and redownload it again yeah so the videos

00:17:04.260 --> 00:17:11.120
will be available they even make them available for two weeks or a month um so and you'll be able

00:17:11.120 --> 00:17:15.300
to just log back in and i think it takes them a little while to process the videos

00:17:15.300 --> 00:17:20.920
um have you received any emails that the videos are available what does your desktop look like

00:17:20.920 --> 00:17:21.920
Let me take a look at it.

00:17:22.020 --> 00:17:30.960
Maybe we can show it through Teams and let's see if they show any videos being available yet.
