쉐도잉 연습: Kubernetes 101 - Episode 3 - Deploying Apps - 영상으로 영어 말하기 배우기

레슨 만드는 중...
1
Thank you.
2
Hello, everybody.
3
Today we're going to focus on deploying, exposing, scaling, and updating an app in Kubernetes, along with a couple other things along the way.
4
So as we start all these live streams, I'd like to say welcome.
5
I'm here in St. Louis, Missouri.
6
It's getting pretty cold here, but please say hello on the live chat and where you're from.
7
And if you're watching this after the live stream is over, unfortunately you won't be able to participate in the live chat, but I still love hearing from you.
8
So feel free to leave a comment below.
9
So I'm going to switch over to my screen share here.
10
And one thing that I noticed was some people, especially in episode one, when we were starting to use Minikube, they were having some trouble installing it,
11
or some people had corporate policies that prevented them from installing it.
12
Or a couple people actually now have M1 Macs that you can't currently run Minikube on.
13
There are ways to work around those kind of things.
14
But in general some people have had trouble getting minikube working on their computers
15
So I actually recorded a separate little video clip for you to show you a way
16
that you can have a free cluster for testing in the cloud So
17
that you don't have to worry about anything running on your
18
local computer as long as you can get Qubicuddle running on your local computer You can work with
19
that cloud and all the examples today
20
And I'll try to make this the case for the rest
21
of this course too all the examples today will work just
22
as well in in this cloud cluster as they would in a local Minikube instance.
23
So here is that video.
24
Back in October, I had a crazy idea.
25
How fast can I get 50,000 Kubernetes jobs deployed in a cluster?
26
After this live stream is over, I'll link to the video I made exploring Kubernetes jobs in a card above me.
27
But if you're watching live, check the description for a link.
28
Linode generously sponsored that milestone video, and they also gave me a link that I could share with anyone to get a free $100 credit on Linode
29
to develop and test in one of their Kubernetes clusters.
30
And I'm happy to report, even though they aren't sponsoring this video, that's amazie.io, that link that they gave me still works,
31
and so if you're having trouble getting Minikube running on your computer, or if you just want a cluster with no fuss to test things out, please visit the link and sign up for a Linode account.
32
The link is in the description below, too.
33
Anyways, assuming you've created a Linode account, creating a cluster is really easy.
34
After you log in, go to the Kubernetes section of the Linode control panel.
35
Label your cluster.
36
In my case, I called it cube 101 after this series.
37
Choose a region, ideally one that's close to where you are so that things don't get too slow.
38
Then choose a Kubernetes version.
39
I chose the latest version of Kubernetes that Linode had available in December 2020.
40
That's today.
41
But if you're watching this a few years from now, it'll probably be really outdated, so just choose the latest version.
42
Then add some nodes to a node pool.
43
You could just add one server, but I like to use at least two servers in any cluster that I build, just to make sure I don't get lazy and build things that work great on one server clusters,
44
but break when you have two, three, or more.
45
Once you click create, it should only take about two minutes for the entire cluster to be up and running.
46
To be able to connect to the cluster, you have to download the kube.config file, and Linode gives you a handy download link.
47
So once all the nodes are running and the kubeconfig link is available, download it, and then switch over to the command line.
48
Minikube automatically configures our kubeconfig file for us, and we haven't really talked about it before,
49
but a kubeconfig file describes exactly how to connect to a Kubernetes cluster's control plane.
50
So we can use tools like kubicuddle to work with the cluster.
51
What I like to do is copy cluster kubeconfig files, try saying that five times fast, into my .kube folder in my home directory.
52
So I'm moving the kube101-kubeconfig.yaml file I downloaded earlier into the path home slash dot cube slash config dash kube101.
53
Now I need to tell kubicuddle what cluster kubeconfig to work with, and I'll do that by setting the kubeconfig environment variable.
54
And now I can start interacting with the Linode Kubernetes cluster
55
just as easily as any other cluster like a Minikube cluster running locally.
56
And with that, I'm going to hand it back to, I guess, myself.
57
Ah, that's a little awkward talking to myself, but that's kind of how you have to be when you're working remote alone all this time.
58
But anyways, so now we have this managed Kubernetes cluster, but I want to go one step further.
59
I'm going to talk about a lot of things in this series, in the Kubernetes 101 series, relates to setting up a cluster, getting the tooling around your cluster, all those kind of things.
60
And a lot of that is stuff that you might not even want to have to do.
61
You might have to spend a lot of time dealing with all the surrounding parts of your cluster.
62
And I mentioned in that video, Linode was not the sponsor, but I'm just extending that generous offer that they gave
63
because a lot of you might want to have a cluster to run.
64
But Amazee.io is actually sponsoring the series, and I thank them so much because they have made this possible.
65
And a company like Amazee.io basically takes all those parts
66
that require a lot of maintenance and building your Kubernetes cluster
67
and managing it and making sure all the right parts are put together inside of it
68
so that you can manage your applications on it.
69
They do all that stuff for you and they make sure it's monitored well, they make sure it's running well, and they'll do that in any cloud environment,
70
whether that's Amazon or Google or Azure.
71
And they They can work in all those different places
72
and help you to make it so that all you're managing is your applications.
73
So today we're going to focus on application deployment in Kubernetes.
74
And the end goal for any of us is to make it so that we're not managing Kubernetes, we're managing our applications.
75
And a company like amazie.io does a great job of helping you work on your applications
76
and they'll take care of all the complicated Kubernetes parts.
77
So anyway, we have this cluster running, and whether you run it in Linode or in Minikube or in some other environment,
78
these directions, one of the great things about Kubernetes in general is
79
that your definition of how to run an application will work anywhere, whether it's local or in the cloud or in some other environment.
80
As we go along further in the course, there are some things that are more specific to certain cloud providers and things like that, but I'll warn you about that when we get to them.
81
But we want to run that Hello Go app.
82
And let me bring up a browser window here.
83
It's on my other computer, so let me bring it up here.
84
Over on hub.docker.com, in the last episode, I pushed up this cube101-go app.
85
And it's a private repository on Docker Hub
86
that only I can pull from and only I can push to because it's in my private account.
87
And so we want to run that in Kubernetes.
88
So, and thank you to Andy.
89
And also, I can't see who else it was because it scrolled past already.
90
But thank you so much for those Super Chat donations helping make this series continue and be sustainable.
91
Although my node, I should say generously, is donating the cluster time for me that I'm still using for the series.
92
So thank you to them for that as well.
93
So I want to run this in Kubernetes.
94
and I have a Minikube cluster running locally here and it's running Kubernetes 1.19.
95
It's funny, Kubernetes 1.20 was just released in the past week and so now already the video that I just made,
96
it is the latest version you can get on Linode's version of Kubernetes
97
but I'm sure that they'll be coming out with 1.19 soon and probably 1.20.
98
So in the world of Kubernetes, anytime that you commit something to a video,
99
it's out of date within probably a few hours if not a day or week.
100
And thank you also to Roger.
101
Very generous.
102
Awesome.
103
So, I want to run this app inside the cluster, so I'm going to say kubectl create deployment,
104
and this is the same thing that we did in episode one.
105
Just creating a deployment.
106
I'll call it Hello Go, because that's our little app, the kub101 go app.
107
And then I'm going to give it an image, equals gearling guy slash, and this is just coming from here, gearling guy slash cube 101 go,
108
I'll even copy it out of there, save a little time.
109
And then I'm going to deploy version 1.0.0.
110
That was the version that we created last week, 1.0.0.
111
And I'm going to go ahead and deploy that.
112
And I'll watch this deployment.
113
watch kubectl get deployment and again i might i mentioned this before
114
but i'm saying kubectl just because that is an official way it's kind of like
115
if you're saying the word gif under protest i'm saying kubectl under protest
116
but when i say
117
that word you can substitute it for whatever you want to say a lot of people say kubectl
118
because it's like system control kubectl anyway off on a tangent there.
119
So I'm going to watch this deployment, get deployment, hello, go, and see what happens here.
120
And I notice that there are no pods available in the deployment, and that's not a great thing.
121
It says ready, zero out of one.
122
And this is a tiny container image, so it should download pretty quickly.
123
So I can say kubectl get pod, and I'm going to use a label of app equals hello
124
go now this is a special label kubernetes allows you to
125
label things to be able to identify them to be able to use them in other places
126
and by default
127
when you create a deployment like this it will create a
128
label the app is equal to whatever the deployment name is
129
so that's a handy way to get any pods
130
that are part of this deployment or get any other resources part of this deployment
131
so i'm just going to say get pod with the label app equals hello go
132
and it's saying that that there's an image pull back off status.
133
Typically if a pod is working, it should just say status running, or if it's a job pod, it should say status completed or finished or something.
134
So this is something bad.
135
And I want to dig into what is causing this.
136
So I'm going to actually use instead of kubectl get, I'm going to use kubectl describe.
137
Describe gives you a little bit more detail on the command line about what's going on.
138
So kubicuddle describe pod dash l app equals hello go, not ag.
139
And I can see here that it's saying fail to pull the image.
140
For most things in Kubernetes, the list of events will give you some good debugging information to get you started.
141
And here it's saying that it failed to pull, and the daemon that's running that is trying to pull the image says that pull access was denied.
142
It may require Docker login.
143
So it looks like we might need to actually authenticate to the cluster, or authenticate to Docker Hub, which makes sense.
144
Minikube on my computer right now doesn't know how to connect to Docker Hub as me, so I'm going to need to tell it about that.
145
And I made another little video, so I will hand it off again to myself
146
and let you guys see how I'm going to connect this Minikube cluster to Docker Hub.
147
The reason my Hello Go deployment is failing is
148
because Kubernetes is trying to pull a container image from a private image repository on Docker Hub,
149
but the Kubernetes cluster itself doesn't have any authentication credentials it can use to do that.
150
So we can create a special kind of Kubernetes secret to store our Docker Hub private registry credentials
151
and then tell Kubernetes to use that secret when it tries running the Hello Go application.
152
What's a Kubernetes secret, you ask?
153
Well, there's special objects you can store inside Kubernetes containing sensitive information like passwords, tokens, or keys.
154
There are some special types of secrets, like a Docker registry secret, which require a certain format when you're creating them.
155
And so, to connect our little cluster to the Docker Hub registry, I'll create a Docker registry secret and name it regcred.
156
The syntax for that is on the screen right now, and you can pass in a username, password, and email.
157
And if you're connecting to a registry besides Docker Hub, you would also need to pass in a server with the option docker-server.
158
And here's one important thing to remember.
159
The password is not the password that you use when you log into Docker Hub in your web browser,
160
but instead it's the value of an access token you configure in your Docker Hub account settings in the security section.
161
And oh my gosh, I hear you saying right now, did Jeff just expose his Docker Hub access token to the whole world?
162
Is Redshirt Jeff trying to create a little mayhem?
163
Relax, by the time that you're watching this pre-recorded segment, I already deleted that access token.
164
Or at least, I hope I remembered.
165
But back to the task at hand.
166
The regcred secret can be used wherever you need pods to pull container images from the private registry.
167
To use it, you can edit a deployment template, like the hello go one we just created.
168
For example, run kubicuddle edit deployment hello-go, then go to the spec section under template and then spec,
169
and add image pull secrets, which is a list, and add one list item with the name regcred.
170
At this point, if you describe the pod that's part of the Hello Go deployment with the same kubectl-describe pod command from earlier, you should see it's pulling the image.
171
There are a few things you need to keep in mind with pull secrets.
172
Every container registry provider uses slightly different terminology and may use different types of access control,
173
so refer to the official documentation for how to connect to your registry if you're not using Docker Hub.
174
And some container platforms even do all the authentication for you, assuming you use a container registry that's connected to the Kubernetes platform like with Amazon EKS.
175
And one last note, we aren't going to dive into the concept of namespaces yet
176
because everything we've done so far is in the default namespace, but pull secrets are specific to a Kubernetes namespace.
177
So when I start talking about namespaces in the next episode, you'll need to remember that any namespace
178
that pulls an image from a private registry will need a pull secret defined in that same namespace.
179
Now, for the second time today, I'll hand things back over to me.
180
I don't think that'll ever be not awkward, but hello again.
181
It is me, and I was just talking to you as myself, but that was actually yesterday, so very strange, but it at least lets me take a little drink
182
and take a break without you hearing me drinking my water and being weird on the stream.
183
So anyways, it looks like things are working now, so that's awesome.
184
The pod is actually deploying because we added the image poll secret,
185
and we can talk a little bit more about some peculiarities with images
186
and polling and things like that in different situations in the future.
187
One thing to keep in mind too is some people have like air-gapped Kubernetes clusters
188
and there's some special things that you need to do if you're going to set that up But this is Kubernetes 101, not Kubernetes 404, so we're not going to talk about
189
that in this series So we have the deployment running
190
and that's awesome But we need to actually use it right now if I go in my web browser, there's no way for me to actually get to this
191
So we need to expose the application to the world so that we can get to it from the outside So,
192
somebody says yesterday same shirt.
193
You notice it said 9am so technically I could be lying.
194
In my terminal it was saying that the times were around 9am.
195
So, but yes it was yesterday.
196
Using the magic of video editing I actually changed shirts.
197
I did not wear the shirt three days in a row.
198
So anyway, we're going to expose this application using Qubicuddle expose and I'll get into how this works in just a second.
199
So I'm going to expose this deployment that we created, HelloGo, and we're going to expose it on port 80,
200
although we won't access it on port 80 on the cluster itself because we're going to use a node port, which I'll talk about in a second.
201
And the target port, this is what it's going to look at in the containers running inside this deployment.
202
The target port is 8180, and you'll remember that if I go to cube 101
203
and go to episode 3 and go to the examples and go to the docker file.
204
That is the port that we're exposing and in the little go app
205
that we ran that is the port that it's listening on right here.
206
So 8180 is the port that we're going to use.
207
We're going to target request to that port and we're going to say type equals node port.
208
And one reason I'm using node port here in case you do know something about Kubernetes is
209
that this will work on the Kubernetes cluster running in Minikube
210
and it will run on a cluster running in Linode if you're doing it that way very easily.
211
And what this does is a node port service and
212
when you run kubectl expose it's going to create a service in Kubernetes.
213
A node port service will run in Kubernetes in its networking layer
214
and it will it will take requests from a port on every node in the cluster.
215
So it'll randomly assign a port on every node, and it'll take all that traffic into this little service, and it'll route those requests to one or more,
216
however many pods are running behind that deployment.
217
And you can expose, you can have services that expose different things.
218
It's not just for deployments, but for the most part in what we do, especially deploying web applications and things like that,
219
be exposing deployments and having services for deployments.
220
So we're going to create this,
221
and I can get the service information with kubectl get service and hello go.
222
And again, when you do things with the defaults, it's just going to take the name of the deployment and make a service for it,
223
just like it took the name of the deployment and added an app label to all the pods that run for it.
224
So we did that, and you can see that the port that it's running on is 32630.
225
So we can get to that.
226
Now this is the cluster IP.
227
This is an internal IP address using Kubernetes' own internal software-defined network that it runs on its own.
228
So we can't access that.
229
If I try going to that in my browser, I'm not going to get anything because it's a private IP address inside the cluster.
230
So this node port is actually on the IP address of any node running in the cluster, and for For Minikube, I can get that IP address with minikube.ip,
231
and I mentioned this in the first episode but might as well cover it again here.
232
This is the IP address of the actual Minikube instance running on my computer.
233
So I'm going to go here, I'll open up a browser window and go to the port that it's running on,
234
the node port, and I should get hello you requested slash.
235
So it's working and if I give it a different URL, it'll give me that.
236
So with Linode, it's a little bit different.
237
There's not an, I mean, there might be a command somewhere using a utility, Linode IP.
238
But for Linode, you just get the IP address of one of the nodes in your cluster, and that's the IP address you could use.
239
And you could use any of the nodes.
240
You can confirm that this is working by using all the different nodes in your cluster.
241
They'll all be exposing the service on this port.
242
So that's the simplest way.
243
If you have an accessible cluster on the internet or on your machine, a node port is an easy way to expose services
244
and test that they're running in a web browser or something like that.
245
So the next thing that we want to do, though, is a lot of applications like HelloGo.
246
This application can probably serve a lot of traffic very quickly, just running one instance.
247
But if we do have multiple nodes in our cluster, or if we want some redundancy
248
when we're doing upgrades of the application where new ones come in
249
and it's not killing off the old one before the new one comes, something like that, we can have multiple instances of it.
250
And that's very easy to manage with Kubernetes.
251
You don't have to create extra servers and things.
252
All you have to do is in a deployment, say, give me multiple replicas of this.
253
And by default, when you create a deployment, it will just give you one replica, which is one instance, but that's not very highly available.
254
And if you have multiple nodes in your cluster for redundancy, if one of the nodes dies and it's the one that was running that one instance,
255
that one replica, then your application will be down until Kubernetes identifies that and brings up another one in its place.
256
So that's never a good thing.
257
So we want to have multiple replicas
258
so Kubernetes can spread them across our cluster and allow them to use more resources and serve more requests.
259
The cool thing about Kubernetes services, thank you very much, Jay.
260
The cool thing about Kubernetes services is
261
that they will continue routing those requests to all the backend pods that you have running, all these different replicas.
262
So we can change that by editing the deployment, just like we did in the video a few minutes ago.
263
Qubicuddle, edit, deployment, hello, go.
264
And if you go down here under spec for the deployment, it's replicas.
265
Now, I didn't mention this too.
266
Kubernetes has a lot of, you're going to deal with a lot of YAML.
267
You can actually do things in different, different syntaxes.
268
You could do it all in JSON if you wanted and do, use different tools and things, but you're going to want to know the basics of YAML.
269
And I'm not going to cover that too much in depth other than what we need to know for this series.
270
But YAML is fairly simple.
271
The one thing to keep in mind is you need to mind your white space.
272
So if I go in Vim here and I'm adding in tab characters,
273
Vim is going to automatically detect that tabs are two spaces.
274
And YAML is in favor of spaces, as am I, but I know that I probably just lost two or three subscribers for saying that.
275
But anyway, Vim is going to auto detect that.
276
But whatever editor you're using, you need to make sure that you're not going to use mixed tabs and spaces because that can break the YAML formatting.
277
And it's important to have the right level of indentation in YAML, otherwise things can mess up.
278
Anyway, for this case, we're going to change replicas from 1 to 3.
279
And when I save this file, so I just changed it, and then I'm going to say WQ to write and quit.
280
And Kubernetes is going to check the syntax.
281
If there's a problem when you edit one of these files, Kubernetes will output the problem at the top of the file and leave you in the file.
282
As long as there's no problem though, it'll dump me back to the command line and start applying the changes
283
that I made to the cluster right away So I'm going to do that and then I'll say kubectl get deployment
284
hello go and We can see that already.
285
It's it seems like it already did the change
286
So I'm also going to say kubectl get pods dash L app equals hello go and make sure
287
So it looks like two of them looks like two of them.
288
These two new ones are already up and running So it's very quick, especially if you have applications that are lightweight and small and don't have to do a lot of setup work.
289
Sometimes applications might need to do extra setup work when you start running them in the cluster.
290
And we'll talk about that further down in the course.
291
But if they're lightweight applications and the container images are pretty small, then scaling up is extremely quick.
292
And later on in the series, we're going to talk about how to make this happen automatically in response to demand.
293
Like if you start receiving a lot of web traffic or if the CPU starts going high, you can scale up very quickly in Kubernetes.
294
And that's one of the best things that I like about Kubernetes is I don't have to worry about things like, you know, if I were on Amazon,
295
I'd have to set up an automatic load balancer and set up some rules for it and do the scaling.
296
And the scaling usually took a couple minutes per instance when they came up.
297
So this is super fast, super efficient and very nice.
298
Now, the other thing that you might be wondering is how did Kubernetes, like how is Kubernetes going to route requests to these things?
299
So if I go back over here and I'm refreshing this page, it's still working, but how do I know that it's actually going to spread the requests over all these different instances?
300
So one quick way to monitor in Kubernetes, the logs for all these pods, because in the, I think it was last episode,
301
I showed you that our application is actually logging all the requests, which is good because then we can debug the thing if we ever need to.
302
Kubernetes has a nice little handy kubi cuddle logs functionality built in
303
and I'm going to follow the logs with dash f just like I would if I were doing a tail
304
And then I'm going to use the same label app equals hello go
305
And the advantage of using labels is I can use this label
306
and it's going to get me all these different pods
307
because all of them have that label attached to them because they're all part of this deployment
308
And I'm also going to use another option called prefix equals true.
309
And what that does is it lets Kubernetes show me which pod and which container in the pod is running.
310
So if I do this, you can see that there's a bunch of requests from n92kc.
311
Those were the initial ones.
312
And those were this initial pod.
313
And then there's some from mrzxc.
314
Long term, as you go down this path, you'll notice that there's a lot of these kind of things.
315
you don't really think of these containers as pets anymore because you really can't, because you can't even identify them by a human-readable name.
316
So Kubernetes helps break you free of that and think of all of your applications running in cattle mode.
317
And really, if I delete this pod, in fact, I'll go ahead and do that really quick.
318
Qubicuddle, delete pod, that.
319
And let's go back once it finishes deleting.
320
Let's see.
321
So I'll go back to here, and you can see that it just brought up a new pod in its place.
322
Kubernetes doesn't really care what happens to your pods and knows that pods come and go, containers die.
323
That's not a big deal, and now a new one's running in its place.
324
Anyway, I'm going to go back and go into the logging and go back over to Safari,
325
and I'll refresh this you can see it seems like there's some sort of pinning based on the client
326
or the session or something because every request here
327
that I'm doing is going to Z7 but
328
if I open up another browser so I'll go to Chrome
329
and I'm gonna go to hello I'll go in Chrome
330
and go here and it's still doing that same one but yeah Let's try curl Go here.
331
Okay, so curl hit a different one. So
332
Kubernetes kind of divides things up You can actually get some more control over
333
that and we're going to talk later about something called ingress in Kubernetes
334
Which gives you even more control over how traffic comes into your cluster and is routed to backends
335
But Kubernetes services by default if I say kubi cuddle get service.
336
And another note that I should say here, because you'll see me do this just because my brain works in different modes,
337
you can also use shorthand for some of these things.
338
So SVC equals service, you know.
339
So instead of writing out service all the time, you can write SVC.
340
A lot of people also alias cubicuddle to K.
341
I don't do that just because when I train people on things, I don't want them to think that K is the way of things.
342
And, you know, you can set up that shortcut if you want, but I'm not going to do it here.
343
kubicuddle get service.
344
Hello, go.
345
And actually, I'm going to use dash o yaml.
346
Dash o changes the output of it, so this output is just a quick at-a-glance output for the screen, but for any object that's in Kubernetes,
347
you can get the yaml for it directly by just saying kubicuddle get service, or you could edit it too, but if you edit it and accidentally make a change, that'd be bad.
348
So I'm just going to get the entire output for how the service is defined in Kubernetes and how it's running.
349
And down here, you can see that it has this session affinity setting, and it's set to none.
350
And that means Kubernetes is doing whatever its default is, which seems like it's kind of all over the board.
351
You can see it, you know, a lot of requests went to this container, then it started going to this container.
352
I don't know exactly how Kubernetes routing engine works in the back end.
353
And as somebody who's worked a lot with like Varnish and HAProxy and Nginx and things like that.
354
There's a lot more control for whether you're using round robin or session affinity or IP affinity or whatever kind of thing.
355
So I don't know how this exactly works when it's set to none, but it seems like it's kind of doing something session affinity-like.
356
But anyway, you can get into that, and I'm sure somebody probably knows a lot more about the way
357
that service routing works in Kubernetes and could school me on that, but we aren't going to go deep into that today.
358
All right, so we have this application running, and we have the pods up.
359
There are three pods right now, and if I kubectl describe the deployment hello go,
360
I can see that right now it's running that version 1.0.0.
361
Now, the marketing team came to me and said, let me go over here, they said that this string of, let me go back to,
362
let me go back to an earlier version of it.
363
Oh, this is the initial version.
364
This is the new version of the app.
365
So marketing came back though, and they said that the version that I had for version 1.0.0, which is here in episode two from from last time,
366
it used the word hello.
367
Hello, you requested.
368
And they said, you know what?
369
In today's day and age, the word hello is way too formal.
370
We want to change things up.
371
We want to be more hip and cool.
372
And so you guys need to drop all of your work on everything else you were doing
373
because obviously maintenance and technical debt are not important.
374
It's more important to be hip and trendy.
375
So, um, and I, there are some good marketers out there, but I'm just having a little fun.
376
So anyway, they want us to change it to high because that's a lot more trendy.
377
That scores well on our A-B testing and it creates more engagement.
378
People stick on the site longer.
379
So yeah, we want to deploy that.
380
And so I created this 1.1.0 version that has that in it.
381
And we want to deploy that.
382
We want to roll that out to the cluster.
383
And so there's a few different ways that you can do that.
384
And long-term, we're going to get into ways
385
that you can automate this process with git or with a system like Jenkins or something like that.
386
But I'm going to show you two ways to do it.
387
One way is to say Qubicuddle edit deployment.
388
Hello go.
389
And if you go in here, you can go down to where the template is and then change the container image here.
390
I could just say 1.0.
391
There's a shorthand way to do it though.
392
Oh goodness, I'm screwing up my thing here.
393
Let me get out of here without.. no, quit.
394
All right.
395
Sometimes when I do Vim while I'm talking, I just can't.. my brain stops working.
396
Anyways, that's one way to do it.
397
The other way is to use some shorthand that kubicuddle has, and I can say, let's see,
398
kubicuddle set image, and that allows me to change the image for a given deployment or a pod or something like that.
399
So I'm going to say set image deployment slash hello go uh qb101 go equals
400
and where i'm getting this from is this is the definition of
401
that the container that's being uh used here
402
so you can see by default it takes the the name of the container not the namespace
403
and container but just the container itself and it labels the container name like
404
that you can specify the name of this container i could have called it my special app or something, but I didn't do that so this is the default that it uses.
405
So this is the container name and then I'm going to set it to gearlingguy cube101-go 1.1.0. Do that.
406
Then I'm going to watch the pods.
407
So watch kubicuddle get pods-l app equals hello go.
408
And I'm going to see that it already already brought up the three new pods
409
so since this is such a lightweight app it's very quick to bring up the new version even pulling down
410
that container it's it's only like six megabytes
411
but it was very quick pulling that down
412
and it terminated the old pods what kubernetes does by default
413
is it will bring up the new pods make sure they're running
414
and then after they're running
415
and working it switches the service to point to those new pods
416
and then it terminates the old ones
417
and it might take a few seconds to clean them up
418
but it does that and it's a rolling deployment
419
and you can actually control a lot about how that happens
420
and this episode i'm not going to deep dive into controlling rolling deployments
421
and things but if you look at
422
if you look at the deployment options here it does have
423
a few things here like strategy rolling update these are the defaults
424
that it sets up and it will it will make sure
425
that there are no more than 25 percent in this case there's three three replicas
426
so that would be one of the three i guess uh it makes sure
427
that there's no more than that percent unavailable at any given time
428
so while it's doing the update it's going to bring up a few it'll tear down a couple make sure
429
that all the new ones are running then it'll bring up a few
430
if you had 10 or 20 replicas i'm talking about
431
and it'll do that so that your application is never actually down which is awesome.
432
And I'm going to talk a little bit about some caveats there, especially because some applications that are out there might not take it
433
that well if you have multiple versions of it running at the same time.
434
So we have to work with our applications
435
and with our application developers to make sure that when they build things and when they update them, they aren't done in a way that can break when you're updating things.
436
So let me get back out of here.
437
and let's see I need to get back to where I am in the notes
438
because I've talked way ahead of where I have my marker all right
439
so we can also make sure that you know we saw
440
that the pods were rolled out I'm also going to say kubi cuddle describe deployment
441
hello go and make sure that the pod version is now 1.1.0 and I can also confirm in my browser browser, if I go here, it has hi.
442
Now, we deployed this, and this is not from experience in any way, of course not.
443
That's sarcasm if you can't tell.
444
But marketing just called up my manager and said, you know what, we just found out that the word hi actually means a very,
445
very bad word in some random foreign language that nobody actually uses and nobody accesses our site.
446
But you know what?
447
This is an emergency.
448
And I know that you guys are going to get back to fixing
449
that other huge bug that's causing you to have to do things every night.
450
But this is the biggest emergency ever.
451
And we're not going to admit that it's our fault that we caused all this work for you.
452
But you guys need to drop everything you're doing and fix that and roll it back to the previous version.
453
So luckily, Kubernetes has an easy way for us to do this.
454
And it's called kubectl rollout.
455
And when you do a deployment, when you change a deployment, Kubernetes rolls that deployment out.
456
And you can also view the history of deployments and also undo things or switch back to an older revision.
457
So we can get the history, just to show you, of the deployment.
458
Hello, go.
459
And it's going to show me that there are three revisions.
460
Now, there's this change cause field.
461
This might actually go away at some point.
462
There's a way to put a message in here.
463
It's a little complicated.
464
If you're building automation for it, you might want to set this up, but doing it by hand is a little annoying.
465
But there's a way that you can add a little message in here that shows like updated to version 1.1.0 or something.
466
But all we need to know is that the first revision was when we deployed this deployment initially, and it wasn't working.
467
The second revision was when we added the image pull secret and then it started working.
468
This third one was updating it from 1.0.0 to 1.1.0.
469
So I want to undo this previous,
470
this last revision, and the quickest way to do that is to do kubicuddle rollout undo deployment.
471
Hello, go.
472
And that's going to just roll back the deployment that I just did, and if I go up to the pods and watch them, you'll see that it already has done it.
473
It has the three new pods running, and we'll confirm with kubectl get described deployment,
474
we'll confirm that it has switched back at this point to 1.0.0.
475
And if I go in the browser, marketing is again happy because it says hello, even though apparently that's not very trendy and hip.
476
It's a safer word.
477
Now, obviously, the word hi, as far as I can tell, the word hi does not have any negative connotations.
478
But I am speaking from experience that these kind of things happen all the time.
479
And you have to deal with them.
480
So Kubernetes helps us to do these things and it's pretty nice
481
Now I mentioned earlier
482
and I'll mention it again Your applications have to be designed in a way
483
that lets you do these things To be able to deploy with a rolling update
484
and to be able to roll back if you have an application And I have some experience with this
485
Applications like Drupal and Magento.
486
I'm I'm traditionally a PHP developer
487
applications like
488
that what they would do a lot of times is you would apply an update to your system
489
and the update would all of a sudden change database schemas
490
and would make a breaking change like it would change the the column name of something
491
or it would change an entire table to something else and
492
so the new version would work with that
493
but then you're like oh my gosh I forgot there's a bug in this the schema translation
494
and we need to roll back so
495
when you roll back it's not just rolling back your application
496
you have to roll back a database to a previous state
497
and so things get really complicated if you applications that aren't built for this kind of rolling update.
498
So you need to make sure that you're talking with application developers
499
and using software that has the ability to update and roll back cleanly.
500
And one way to do that, and one way that I've built all of my applications that use things like databases, is instead of having an update,
501
modify a schema, what you do is you like create a duplicate table
502
or you add a new column and start using the new column in the new version, but also translating it and keeping the old column up to date.
503
And then at a future point, maybe three or four point releases down the line, then you drop that old column once you know all your new code is working.
504
So it requires a little bit more discipline, but it allows you to do this update
505
and rollback process a lot easier because you're not breaking your entire application doing a rollback.
506
So that's something to keep in mind.
507
It's one of the things that you start realizing, even if you're just using, even if you're deploying a big application in production in general,
508
everybody has had to roll something back at least once in their lifetime, if you've been in this industry long enough.
509
And I'm pretty sure that most of us have a painful story about a rollback that's gone horrendously wrong.
510
And anything that we can do to help prevent that is a good thing.
511
So let's see.
512
So that is all I have for today's episode.
513
And in the next episode, this was kind of a convoluted example.
514
It's really simple.
515
It's just a little thing that prints out a line.
516
It has no state that it has to track.
517
It has no persistence.
518
There's no database it's interacting with.
519
But it does show all the different things that you can do with deployments, and it's important to get a basic understanding.
520
And a lot of people have also asked me on Twitter especially, oh, are you going to talk about this magical tool
521
that you can use with Kubernetes or this system that you use with Kubernetes?
522
And I'm not going to get into some of those until very, very late in this course, mostly because just like with Git, I don't like the idea of using a tool
523
that provides magic layers on top of something until you understand the magic layers underneath.
524
So we're going to stay in the command line most of the time
525
and do things manually always first so
526
that we can understand how those manual parts work before we get into these fancy tools
527
that automate more for you and do more for you behind the scenes.
528
So next episode, we're going to take a look at an actual real world application running inside Kubernetes, in this case, Drupal.
529
And the reason I chose Drupal is there's actually two reasons.
530
One is the company that is sponsoring this Amazie.io.
531
I knew them a lot from back in the day from a lot of the Drupal things they do.
532
They do tons of different things too, but they have been highly involved in the Drupal open source community, as have I.
533
So I know Drupal really well, but it also is an application that is legacy and modern.
534
So it has some features that are hard to deal with in Kubernetes
535
and some features that are easy to deal with in Kubernetes.
536
And I want to show some of those things
537
because I know a lot of us are probably going to be running clusters
538
that run some apps that might be stateless and modern and fancy and amazing, but a lot of us are going to be running applications
539
that are more practical and old and have a history to them
540
that are not as easy to get running cloud native like Drupal.
541
And we're also going to find some of the new challenges that brings and how to deal with them.
542
And we're going to get a lot deeper into YAML.
543
So today was a very light introduction to YAML using Vim on the command line, but next episode we're going to get a little bit deeper dive
544
and I'll talk about a little bit how I make sure that my YAML is correct and things like that.
545
And thank you, Ricky Holland 87 as well.
546
It's great to see where everybody's from.
547
I am so happy with this course.
548
I've been planning it for so long.
549
Please consider subscribing if you want to keep watching these videos.
550
And again, everything is online at cube101.jeffgirley.com.
551
All the apps as I upload them will be available here.
552
And this will be a reference in case you want to go back and learn more.
553
So consider subscribing.
554
My book, Ansible for Kubernetes, is still available for $5.
555
and until next time, I'm Jeff Geerling.
556
Thank you.
557
Thank you.

실제 상황: 클라우드 클러스터 설정 가이드

이 비디오는 쿠버네티스 클러스터를 로컬이 아닌 클라우드에서 설정하는 방법을 설명하는 대화입니다. 발화자는 Minikube 설치에 어려움을 겪는 시청자들에게 Linode를 이용한 무료 클러스터 생성 방법을 알려주고, 단계별로 안내합니다. 일상적인 설명과 실용적인 팁이 섞여 있어, 기술적인 내용을 설명하는 대화의 흐름을 익히기에 좋습니다.

유용한 구문과 어휘 조합

  • have trouble + 동사-ing: "some people were having trouble installing it" (일부 사람들은 설치하는 데 어려움이 있었습니다). 문제 상황을 설명할 때 자주 사용되는 구문입니다.
  • work around: "There are ways to work around those kind of things" (그런 문제를 해결할 방법이 있습니다). 어려움을 극복하는 방법을 말할 때 유용합니다.
  • sign up for: "sign up for a Linode account" (Linode 계정을 등록하세요). 서비스 가입을 설명할 때 자주 사용됩니다.
  • switch over to: "switch over to the command line" (명령줄로 전환하세요). 다른 도구나 화면으로 전환할 때 사용하는 표현입니다.
  • configure for: "Minikube automatically configures our kubeconfig file for us" (Minikube는 자동으로 kubeconfig 파일을 설정해 줍니다). 설정 과정을 설명할 때 유용합니다.

당신의 쉐도잉 챌린지

영어 쉐도잉(shadow speech) 연습을 위해, 비디오에서 "creating a cluster is really easy"부터 "download the kube.config file"까지의 부분을 선택하세요. 다음 단계를 따라 해보세요:

  1. 원본을 2-3번 듣고, 발음과 억양, 말하는 속도를 파악합니다.
  2. 원본을 멈추지 않고, 1-2초 지연시켜 따라말합니다 (shadow speak). 발음 뿐만 아니라 강세와 쉼표의 위치도 주의깊게 따라하세요.
  3. 녹음기를 사용해 자신의 목소리를 녹음한 후, 원본과 비교합니다. 어디가 다른지 찾고, 다시 연습합니다.

이 연습은 IELTS 스피킹과 같은 실제 의사소통에서 자연스러운 흐름을 만들어 주며, 기술적인 용어도 함께 익힐 수 있습니다. 매일 5분씩 연습하면 빠르게 실력이 향상될 것입니다!

이 영상의 문법

화자가 가장 많이 쓰는 문형을 영상 속 실제 표현과 함께 정리했습니다.

문형영상 속 표현
현재완료 have/has + 과거분사 — 과거의 일이 지금도 관련이 있을 때you've created · haven't really talked · have made
수동태 be + 과거분사 — 누가 하는지보다 무슨 일이 일어나는지에 초점be really outdated · are put · was just released
관계절 who / which + 절 — 사람이나 사물에 대한 추가 정보Hub, which makes · secrets, which is · replica, which is

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.

섀도잉 방법: 단계별 전체 가이드 읽기 →