1 00:00:01,220 --> 00:00:06,380 In the last video I showed you method number one for making changes to a deployment at the very end 2 00:00:06,380 --> 00:00:06,920 of the video. 3 00:00:06,920 --> 00:00:11,750 I told you that we would really be well served to not have to specify the version of an image inside 4 00:00:11,750 --> 00:00:13,490 of our deployment config file. 5 00:00:13,530 --> 00:00:18,230 The reason for that is that if we have to ever open up this file just to change the version of some 6 00:00:18,230 --> 00:00:21,850 image that's always a possibility of introducing some kind of error. 7 00:00:21,950 --> 00:00:25,700 We could very easily accidently make a type of somewhere or we could actually type in the incorrect 8 00:00:25,700 --> 00:00:30,920 version number and so it would be really great if we could figure out some way to not have to specify 9 00:00:30,920 --> 00:00:32,440 the version whatsoever. 10 00:00:32,600 --> 00:00:36,080 And that's what we're going to do inside this video. 11 00:00:36,100 --> 00:00:39,840 Let's take a look at a series of steps that are going to outline exactly how this is going to work. 12 00:00:41,090 --> 00:00:43,500 But this is method number two. 13 00:00:43,520 --> 00:00:48,150 The first you're going to do is to make sure that our deployment is using the latest tag in the pod 14 00:00:48,210 --> 00:00:49,830 spec section. 15 00:00:49,980 --> 00:00:55,410 So back inside of that config file we'll find that image version right there and we can change it to 16 00:00:55,410 --> 00:01:01,980 either latest like so or remember if we just leave off that designation entirely then Docker assumes 17 00:01:01,980 --> 00:01:06,390 that we want to use latest so we can either put on latest or just leave it off entirely. 18 00:01:06,390 --> 00:01:10,570 It is up to you will then save this file. 19 00:01:10,600 --> 00:01:14,180 Now remember just saving this can pick file does nothing whatsoever. 20 00:01:14,200 --> 00:01:18,040 We have to actually take this config file and apply it to our cluster. 21 00:01:18,040 --> 00:01:22,800 So let's do that right now so that the deployment inside of our cluster understands that it should tried 22 00:01:22,800 --> 00:01:24,090 to use the latest version. 23 00:01:24,100 --> 00:01:34,960 Image so back at my terminal I'm going to make sure that I'm inside that infra K AIDS directory and 24 00:01:34,960 --> 00:01:37,190 there's the deployment file right there. 25 00:01:37,190 --> 00:01:44,070 So do a cube CTO apply dash f O's dash double dot demo OK. 26 00:01:44,100 --> 00:01:47,950 So we've now updated our deployment and we told it to try to use the latest version. 27 00:01:48,000 --> 00:01:55,500 Now at this point time if you do a cube Seitel get deployments and you see that we are not running one 28 00:01:55,500 --> 00:02:01,490 pod that is told OK so if you see an error or anything like that right now don't sweat it let's now 29 00:02:01,490 --> 00:02:03,680 go through the series of steps we have back here. 30 00:02:03,860 --> 00:02:07,510 So our deployment is now using the latest tag in the pod spec section. 31 00:02:07,550 --> 00:02:11,240 Now step number two we are going to go ahead and make an update to our code. 32 00:02:11,240 --> 00:02:13,860 So let's make an update to our post code base. 33 00:02:13,940 --> 00:02:18,710 We'll then rebuild the image and then we're going to take that image and push it off to up to Docker 34 00:02:18,710 --> 00:02:21,790 Hub so I'm going to go backwards. 35 00:02:21,810 --> 00:02:27,690 My editor will find a post project directory and the index not just file inside their here's the change 36 00:02:27,690 --> 00:02:29,200 that we made just a moment ago. 37 00:02:29,280 --> 00:02:30,980 Let's make another change right now. 38 00:02:31,830 --> 00:02:35,880 I'm going to change the VA twenty to maybe version fifty five. 39 00:02:35,880 --> 00:02:37,800 Maybe we're just doing huge updates here. 40 00:02:37,800 --> 00:02:38,760 Who knows what. 41 00:02:38,760 --> 00:02:44,550 Whatever we've got some change I'll save that file and then we are going to once again rebuild this 42 00:02:44,550 --> 00:02:48,110 image back at my terminal. 43 00:02:48,110 --> 00:02:56,160 I'll go back into our post directory and inside there we'll rebuild the image with Docker build dash 44 00:02:56,250 --> 00:03:03,540 t your Docker I.D. slash posts and then a dot at the very end again to designate that we want to use 45 00:03:03,570 --> 00:03:08,110 all the code inside of posts OK. 46 00:03:08,160 --> 00:03:10,610 So we've now rebuilt this image. 47 00:03:10,680 --> 00:03:14,190 You'll notice that we have this implicit version added on of latest. 48 00:03:14,190 --> 00:03:21,970 So we're not going to take that image and push it up to Docker Hub so back at my terminal I'll do a 49 00:03:21,970 --> 00:03:26,240 docker push my Docker I.D. slash those 50 00:03:29,670 --> 00:03:33,810 that's going to take the image that we just built and attempt to push it up to Docker Hub. 51 00:03:33,810 --> 00:03:38,310 Now just to save a little bit of time I already built this thing and pushed it up a moment ago just 52 00:03:38,310 --> 00:03:42,750 to save time in this video but for you it's probably and take a minute or two to actually take all the 53 00:03:42,840 --> 00:03:47,400 image data and throw it up to Docker Hub which is totally fine. 54 00:03:47,550 --> 00:03:47,780 OK. 55 00:03:47,810 --> 00:03:51,830 So we've now pushed all these versions or this latest version up to Docker Hub. 56 00:03:51,830 --> 00:03:57,410 So now we want to somehow tell our deployment to use that latest version to do so all we can do is run 57 00:03:57,410 --> 00:04:04,200 QC tell rollout restart deployment and then the name of the deployment itself let's try that out right 58 00:04:04,200 --> 00:04:09,930 now going to first get all my deployments just to make sure I recall the name of the deployment. 59 00:04:09,940 --> 00:04:16,900 There it is right there and they'll do a UCL rollout restart deployment 60 00:04:19,490 --> 00:04:25,220 and then the name of our deployment is post dash devil OK. 61 00:04:25,280 --> 00:04:28,030 So it looks like the deployment has now been restarted. 62 00:04:28,240 --> 00:04:32,600 So let's now do a get deployments again. 63 00:04:32,690 --> 00:04:34,820 It looks like we do have one pod running. 64 00:04:34,820 --> 00:04:38,880 Let's get a list of all of our pods and just make sure that's using the latest version of our code. 65 00:04:38,890 --> 00:04:44,010 Now we'll do a keeps EDL get pods there is our pod. 66 00:04:44,010 --> 00:04:46,610 It looks like it was created just 18 seconds ago. 67 00:04:46,650 --> 00:04:48,540 That's definitely a good sign. 68 00:04:48,540 --> 00:04:53,160 Let's now try to get logs out of this pod and just make sure that we see that V fifty five in there 69 00:04:53,310 --> 00:04:56,730 just to make sure that we are using the latest version of our code. 70 00:04:56,820 --> 00:05:07,330 So I'll do a QVC DL logs and then the name of the pod and there we go there's our 55 awesome OK. 71 00:05:07,360 --> 00:05:12,430 So again two versions or two methods to update the image used by a deployment. 72 00:05:12,430 --> 00:05:16,780 We've got method number one which is going to require us to specify a version number inside of our config 73 00:05:16,780 --> 00:05:19,270 file which is something that we don't really like to do. 74 00:05:19,900 --> 00:05:22,880 So instead I recommend going with this solution right here. 75 00:05:23,050 --> 00:05:25,580 We're going to just always use the latest tag. 76 00:05:25,750 --> 00:05:31,750 Make an update to our code push the image to Docker Hub and then run that command and we're good to 77 00:05:31,750 --> 00:05:32,120 go. 78 00:05:32,170 --> 00:05:36,600 Our cluster is now run the latest version of all of our code. 79 00:05:36,650 --> 00:05:36,920 All right. 80 00:05:36,950 --> 00:05:40,980 Now we've got this all put together one last thing around the world of Cuban eddies in just a moment. 81 00:05:41,000 --> 00:05:42,310 So I'll see you in just a minute.