1 00:00:02,730 --> 00:00:04,298 ‫For Kubernetes, it's a series of 2 00:00:05,820 --> 00:00:08,461 ‫different containers. We've talked about that. On top of 3 00:00:08,462 --> 00:00:11,519 ‫that, you have a command line tool that's 4 00:00:11,520 --> 00:00:13,534 ‫not necessarily bundled with those containers that run on 5 00:00:13,535 --> 00:00:16,181 ‫the server. So, you've got some more parts than Docker 6 00:00:17,430 --> 00:00:19,594 ‫would normally have, and there's different ways to set this 7 00:00:19,595 --> 00:00:22,192 ‫up. In fact, there's tons and tons of ways to install 8 00:00:22,500 --> 00:00:24,060 ‫Docker. There's lots of distribution. 9 00:00:24,280 --> 00:00:25,499 ‫There's lots of installer tools. 10 00:00:26,290 --> 00:00:29,083 ‫Each way will be slightly different and package different 11 00:00:29,250 --> 00:00:31,847 ‫containers. Largely there's going to be the same four 12 00:00:33,270 --> 00:00:36,090 ‫or five containers that you have to deal with. We're really 13 00:00:36,091 --> 00:00:37,314 ‫focused just on learning right now. 14 00:00:37,610 --> 00:00:39,094 ‫So, I want to get you the local setup, the 15 00:00:40,560 --> 00:00:43,261 ‫easiest way for you to use. There's certain other things 16 00:00:43,262 --> 00:00:46,055 ‫that I look at, too, for the best way to install is, what 17 00:00:46,650 --> 00:00:49,223 ‫is RAM utilization and is it easy to turn off? 18 00:00:49,480 --> 00:00:51,689 ‫Because these are things where you've got a lot of 19 00:00:51,690 --> 00:00:54,336 ‫containers running in the background. You may not want 20 00:00:54,483 --> 00:00:56,166 ‫those to always be running. You know, how is it easy? 21 00:00:56,167 --> 00:00:57,644 ‫Is it easy to reset it? 22 00:00:58,440 --> 00:01:00,782 ‫Is it easy to use with my local system? 23 00:01:01,190 --> 00:01:03,449 ‫Rather than just always having to refer to some foreign 24 00:01:03,450 --> 00:01:06,419 ‫endpoint somewhere else. With Docker 25 00:01:06,420 --> 00:01:08,527 ‫Desktop, if you have Docker Desktop, that's 26 00:01:09,600 --> 00:01:12,269 ‫the best way to go. That's the easiest install of all 27 00:01:12,270 --> 00:01:15,140 ‫Kubernetes. If you have Docker Desktop, just use that. 28 00:01:15,190 --> 00:01:17,230 ‫If you have Docker Toolbox, then you're probably going to 29 00:01:17,720 --> 00:01:20,513 ‫want to use minikube, which is very similar to the Docker 30 00:01:21,000 --> 00:01:24,036 ‫Machine command line, which is what makes Docker Toolbox 31 00:01:24,210 --> 00:01:25,551 ‫work. We'll talk about that in a minute. 32 00:01:27,210 --> 00:01:29,369 ‫If you're someone who's got Linux on your desktop or you 33 00:01:29,370 --> 00:01:32,132 ‫just want to do this natively in a Linux VM you've already 34 00:01:32,133 --> 00:01:34,193 ‫created, either on your machine or on the Internet, then 35 00:01:34,940 --> 00:01:37,533 ‫the easiest way there to probably set it up for learning 36 00:01:37,534 --> 00:01:38,534 ‫purposes is Microk8s. 37 00:01:38,860 --> 00:01:41,212 ‫It's made by Ubuntu, but you can install it on a 38 00:01:42,840 --> 00:01:44,129 ‫lot of different distributions. It's not specific to just 39 00:01:44,130 --> 00:01:46,430 ‫Ubuntu. If you're just not at 40 00:01:48,000 --> 00:01:49,892 ‫a place where you can install Kubernetes, or you don't want 41 00:01:49,893 --> 00:01:52,109 ‫to create a cloud VM or whatever, and you just want to 42 00:01:52,110 --> 00:01:53,901 ‫learn it in a browser, that's fine too. 43 00:01:54,030 --> 00:01:56,300 ‫There's two good options one of them is play-with-k8s, 44 00:01:57,050 --> 00:01:59,109 ‫which is made by the same group as 45 00:02:00,000 --> 00:02:01,640 ‫play-with-docker. Then there's katacoda. 46 00:02:02,040 --> 00:02:03,265 ‫Katacoda is very similar. 47 00:02:04,250 --> 00:02:06,600 ‫In fact, if you looked at both of these tools, they look 48 00:02:06,601 --> 00:02:07,613 ‫like they do the same thing. 49 00:02:07,930 --> 00:02:10,502 ‫The slight difference there is that the 50 00:02:11,760 --> 00:02:14,309 ‫play-with-k8s requires that you actually install the 51 00:02:14,310 --> 00:02:15,310 ‫cluster and set it up. 52 00:02:16,420 --> 00:02:18,231 ‫Katacoda already provides the setup for you. 53 00:02:18,550 --> 00:02:20,752 ‫It's, I think, a better tool to learn with 54 00:02:21,620 --> 00:02:24,247 ‫because it doesn't require you to worry about installation, 55 00:02:24,248 --> 00:02:27,005 ‫which you might just wait later to learn how to do that and 56 00:02:27,060 --> 00:02:29,729 ‫just focus on how it works, what the command lines look 57 00:02:29,940 --> 00:02:32,490 ‫like, and stuff like that. If you had to choose between one 58 00:02:32,491 --> 00:02:35,639 ‫or the other, look at the resources of this lecture for 59 00:02:35,640 --> 00:02:37,139 ‫the link to the katacoda playground. 60 00:02:37,180 --> 00:02:39,620 ‫For me, I would prefer Docker Desktop because 61 00:02:41,970 --> 00:02:43,469 ‫it provides me several things out-of-the-box. One, it's a checkbox 62 00:02:43,470 --> 00:02:46,530 ‫to install Kubernetes on my existing Docker setup. 63 00:02:46,720 --> 00:02:49,072 ‫Whatever the Linux VM is on Mac or Windows, it's 64 00:02:49,710 --> 00:02:52,071 ‫going to automatically add the Kubernetes setup to that. 65 00:02:52,080 --> 00:02:55,090 ‫Then it's also going to install the kubectl command 66 00:02:55,650 --> 00:02:58,949 ‫line on my local machine, whether it's Mac or Windows, and 67 00:02:58,950 --> 00:03:01,590 ‫make sure that version is the right version to match to the 68 00:03:01,591 --> 00:03:04,433 ‫server. In fact, if using Docker Desktop Enterprise, which 69 00:03:04,680 --> 00:03:08,039 ‫is a new paid offering from Docker, they 70 00:03:08,040 --> 00:03:10,942 ‫actually allow you to swap between different versions of 71 00:03:11,050 --> 00:03:14,309 ‫Kubernetes on the fly in case you're maybe in 72 00:03:14,310 --> 00:03:16,799 ‫an Enterprise environment that is specific to different 73 00:03:16,800 --> 00:03:18,980 ‫clusters running different versions, and you want to test 74 00:03:20,580 --> 00:03:22,259 ‫different versions locally very easily. Most of us won't 75 00:03:22,260 --> 00:03:24,809 ‫need to do that. So, the free version of Docker Desktop 76 00:03:24,810 --> 00:03:26,513 ‫works just fine like you use in the rest of this course. 77 00:03:26,870 --> 00:03:29,230 ‫The other nice little thing there is that Kubernetes uses 78 00:03:30,210 --> 00:03:32,336 ‫up a decent amount of resources on your machine. 79 00:03:32,470 --> 00:03:34,969 ‫Docker is already using resources so it's sometimes 80 00:03:35,510 --> 00:03:38,243 ‫a little tight to also running Kubernetes on top of that 81 00:03:38,690 --> 00:03:39,747 ‫and then get the rest of your work done. 82 00:03:39,950 --> 00:03:41,420 ‫So, Docker Desktop provides 83 00:03:43,020 --> 00:03:45,002 ‫a quick little checkbox in the menus to allow you to 84 00:03:45,003 --> 00:03:47,399 ‫disable the Kubernetes part of the cluster while still 85 00:03:47,400 --> 00:03:48,689 ‫leaving Docker running. 86 00:03:48,960 --> 00:03:51,719 ‫That's a neat option because sometimes I just want Docker 87 00:03:51,720 --> 00:03:52,720 ‫and I don't need Kubernetes. 88 00:03:53,380 --> 00:03:55,620 ‫All right. Next up, if you're a Docker Toolbox person, 89 00:03:55,640 --> 00:03:58,431 ‫minikube is the closest replacement to that. 90 00:03:58,780 --> 00:04:02,009 ‫It doesn't even need Docker Toolbox to 91 00:04:02,010 --> 00:04:03,751 ‫be installed, so you could totally just run this 92 00:04:03,752 --> 00:04:04,752 ‫separately. 93 00:04:05,580 --> 00:04:08,211 ‫It's very similar in the way that Docker Toolbox works. 94 00:04:08,700 --> 00:04:12,029 ‫I think for those of you using Toolbox, this 95 00:04:12,030 --> 00:04:14,400 ‫will be a similar experience. You would download the 96 00:04:14,401 --> 00:04:17,231 ‫installer on Windows for the minikube 97 00:04:17,600 --> 00:04:19,217 ‫binary and it would install that. 98 00:04:19,231 --> 00:04:22,139 ‫You could just download the binary directly from GitHub or 99 00:04:22,140 --> 00:04:23,370 ‫you could just download the installer. 100 00:04:23,860 --> 00:04:26,222 ‫I kind of like the installer just because that's the 101 00:04:26,223 --> 00:04:27,223 ‫Windows way of installing things. 102 00:04:27,810 --> 00:04:29,851 ‫You can also get it off Chocolatey, if you're into that. 103 00:04:29,852 --> 00:04:32,490 ‫Regardless of which method you get it downloaded, it's a 104 00:04:32,491 --> 00:04:34,321 ‫single binary, and once you get it there, you just type 105 00:04:34,680 --> 00:04:38,100 ‫minikube start. That assumes you have BirtualBox installed, 106 00:04:38,180 --> 00:04:40,630 ‫which if you have Docker Toolbox, VirtualBox would 107 00:04:41,920 --> 00:04:44,369 ‫have been installed already. The nice thing is, is this 108 00:04:44,370 --> 00:04:47,180 ‫uses that same virtualization backend by default. 109 00:04:48,360 --> 00:04:50,431 ‫The other thing is that the commands of it are very similar 110 00:04:50,432 --> 00:04:52,170 ‫to Docker Machine as well. You start. 111 00:04:52,171 --> 00:04:53,396 ‫You can remove a machine. 112 00:04:53,791 --> 00:04:56,535 ‫You can reboot the machine. You can do all those typical 113 00:04:56,580 --> 00:04:58,380 ‫things like you could with Docker Toolbox. 114 00:04:58,890 --> 00:05:01,800 ‫But the one gap here is that it doesn't install the 115 00:05:02,190 --> 00:05:04,500 ‫Kubernetes command line that you would most often use, 116 00:05:04,980 --> 00:05:07,289 ‫kubectl, which is what we're going to use throughout the 117 00:05:07,290 --> 00:05:08,789 ‫rest of this section. 118 00:05:08,850 --> 00:05:11,999 ‫So, you're going to have to go and install that separately, 119 00:05:12,000 --> 00:05:14,160 ‫which is just its own single binary. 120 00:05:14,400 --> 00:05:15,689 ‫There's multiple ways to install it. 121 00:05:15,720 --> 00:05:18,660 ‫In fact, when the minikube is finished setting up, 122 00:05:18,690 --> 00:05:20,579 ‫it will give you a URL that you can go find the 123 00:05:20,580 --> 00:05:21,990 ‫instructions on how to do that. 124 00:05:22,410 --> 00:05:24,179 ‫All of this really shouldn't take you very long. 125 00:05:24,300 --> 00:05:27,149 ‫All in all, it's really just VirtualBox and a couple of 126 00:05:27,150 --> 00:05:30,239 ‫executables on your machine and away you'll go. 127 00:05:30,300 --> 00:05:32,849 ‫You'll have the VM running. It'll have kubectl on your on 128 00:05:32,850 --> 00:05:35,639 ‫your Windows machine that talks to that VM, and then you're 129 00:05:35,640 --> 00:05:39,120 ‫ready to start. For those of you that are on Linux 130 00:05:39,150 --> 00:05:42,209 ‫as your host OS, or you just installed your own 131 00:05:42,270 --> 00:05:44,684 ‫Linux VM, or maybe using a Linux VM in the cloud, the 132 00:05:45,330 --> 00:05:47,999 ‫easiest way I think to get Kubernetes running on that 133 00:05:48,000 --> 00:05:50,999 ‫machine is to use Microk8s, which is 134 00:05:51,000 --> 00:05:54,149 ‫from Canonical, the company that makes Ubuntu, but 135 00:05:54,180 --> 00:05:56,700 ‫it works on any Linux distribution, I think. 136 00:05:56,730 --> 00:05:58,919 ‫I checked the list and it was pretty comprehensive. 137 00:05:59,280 --> 00:06:00,413 ‫It installs using Snap. 138 00:06:00,990 --> 00:06:03,832 ‫If you're not familiar with Snap, it's a different type of 139 00:06:03,960 --> 00:06:06,839 ‫installation technology, but does the same thing is 140 00:06:07,140 --> 00:06:08,190 ‫apt-get or Yum. 141 00:06:08,490 --> 00:06:10,410 ‫You just have to get Snap installed first. 142 00:06:10,420 --> 00:06:12,719 ‫If you don't already have it, you can just type snap and if 143 00:06:12,720 --> 00:06:14,789 ‫it says it can't find the program, then you know you don't 144 00:06:14,790 --> 00:06:15,790 ‫have Snap installed. 145 00:06:16,080 --> 00:06:18,930 ‫You can probably find Snap in apt-get 146 00:06:19,130 --> 00:06:22,199 ‫or Yum. Once you have that, you would use a Snap command 147 00:06:22,530 --> 00:06:23,720 ‫to install the Microk8s. 148 00:06:24,870 --> 00:06:27,089 ‫Once you've done that, it will do everything else for you. 149 00:06:27,390 --> 00:06:29,639 ‫It will install all the different master roles. 150 00:06:29,870 --> 00:06:31,920 ‫It will automatically install the correct version of 151 00:06:32,160 --> 00:06:34,463 ‫kubectl. It gives you a nice set of commands to 152 00:06:35,130 --> 00:06:37,949 ‫manage the Kubernetes system with 153 00:06:39,450 --> 00:06:42,839 ‫microk8s.something. You can do microk8s.enable 154 00:06:43,030 --> 00:06:44,665 ‫and other different commands. If you just type microk8s. 155 00:06:44,666 --> 00:06:47,939 ‫and hit your Tab key a couple of times, you'll see 156 00:06:48,180 --> 00:06:50,160 ‫it list out all the various options. 157 00:06:50,490 --> 00:06:52,940 ‫It's easy to manage that, even uninstall it pretty 158 00:06:53,580 --> 00:06:55,260 ‫quickly if you don't want Kubernetes anymore. 159 00:06:55,770 --> 00:06:57,719 ‫The one quirk with this one is it doesn't give you the 160 00:06:57,720 --> 00:06:59,407 ‫default kubectl out-of-the-box. 161 00:07:00,060 --> 00:07:02,879 ‫I think that's to keep it from conflicting with...maybe if 162 00:07:02,880 --> 00:07:05,526 ‫you have kubectl already installed, it gives you a new 163 00:07:06,060 --> 00:07:07,744 ‫command that is the microk8s.kubectl. 164 00:07:09,480 --> 00:07:12,119 ‫What I recommend is if using Bash or Zsh is 165 00:07:12,810 --> 00:07:15,749 ‫to go in to your profile that automatically runs 166 00:07:15,780 --> 00:07:18,689 ‫every time you log in and simply add an alias 167 00:07:18,960 --> 00:07:22,139 ‫so that you can type kubectl and it will control 168 00:07:22,320 --> 00:07:24,917 ‫this cluster. As we go through the examples with that 169 00:07:24,930 --> 00:07:27,599 ‫command line, I don't want you to keep forgetting that oh 170 00:07:27,600 --> 00:07:30,050 ‫yeah, on my machine, I have to type microk8s.kubectl, 171 00:07:31,260 --> 00:07:33,660 ‫right. So, you definitely want to make that alias. 172 00:07:33,690 --> 00:07:36,600 ‫I always do that. A little tip there is I actually 173 00:07:36,900 --> 00:07:40,110 ‫just make my alias the letter K, so I didn't have to type 174 00:07:40,350 --> 00:07:43,139 ‫kubectl. I can just type K and then something else, 175 00:07:43,300 --> 00:07:46,439 ‫right. You could do that as well instead of the full word 176 00:07:47,130 --> 00:07:49,019 ‫kubectl. That's maybe something you do later once you've 177 00:07:49,020 --> 00:07:50,130 ‫got all this stuff down.