Manage Docker and Kubernetes in VSCode

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody this is Christian and today we're talking once more about container management if you're following my channel you know that I've already tried out many different tools to manage Docker or kubernetes workloads in my home lab we've covered some cool weap UI like POA and Rancher C tools like doer compos Cube CDL and even some weird ones like K9s but one thing that I haven't shown you yet is how I'm actually managing my containers in VSS code and let me tell you this one thing if you want to have a simple and comfortable way to manage workloads and resources in a home lab I think vs code is probably the best tool you can use for that at least for me it's my absolute favorite and in today's video I'll show you exactly why and which plugins you need to install to make vs code the best container management tool out there so let's have a look but before we start with container management we need to talk about container security and I'd like to show you a new amazing tool that is created by the makers of Cub escape and this is called armo thanks armo by the way for supporting this video armo lets you scan your entire kubernetes cluster against common vulnerabilities and compliance policies showing you all the problems and issues you got in a nice and clean web UI for example if you got an issue with configuration settings it shows you all the affected name spaces and objects the severity remediation tactics and it gives you a smart recommendation on how to exactly fix them in your manifest that is really useful and for vulnerabilities it also shows you whether they are fixed in a specific version and what you need to upgrade to what is extremely useful in armor because most of these tools they produce a hell lot of noise yeah even for small demo kubernetes clusters you will likely have hundreds or thousands of different theoretical findings but how do you quickly find out what needs your attention in the armor attack path tools you can very easily find out so what services are actually accessible from the public internet what's the connection path and does the object at the end have problems that could potentially be exploited this is what you need to carefully look at first and I love that Armor Spends a lot of effort on visualizing or highlighting these important things beyond all the noise that container orchestration just creates it's really a great tool just a quick look at the pricing it's entirely free for one cluster up to 10 worker nodes so feel free to use it in your home lab try it out I leave give you a link in the description down below some of you might wonder why did I even consider switching my container management platform to a code editor while we have all these amazing container management tools out there like painer Rancher Argo CD Cube CDL darker compost I could name so many other great tools that are solely created for container management or container orchestration but that's the whole point yeah because in it we often are too heavily focused on all these different tools than on the stuff that actually matters and I realized that I spent most of my time filling around with these different tools understanding the specific requirements limitations and workflows that you need to familiarize yourself with and instead I could actually have invested that time much better when just deploying the stuff easy and simple sometimes less is more and that is why I decided to drastically reduce the number of tools that I'm using in my own container work flows and processes of course I'm still testing and trying out many many tools but I'm very carefully choosing which ones I'm using myself and what I found out is that vs code is a pretty great container management platform for me if you install the right extensions and plugins I can literally do like 90% of all of the stuff that I have to do in my home lab with just one single tool that is vs code and it also has some really great advantages over those big and beefy container management platforms because it has a really light footprint yeah everything is just running locally you don't need to install anything on your Docker server or on your container orchestration you just run vs code on your local workstation and from there you can create and manage all the different resources like darker compos files or kubernetes manifest but you can also use the same tool for deploying them so as a conclusion vs code is a pretty great tool for managing container workflows but let me give you a deep dive about this and let's talk about the right extensions what you need to install and how I'm actually using vs code to manage my container workflows let's have a look so first of all for those of you who have never worked with vs code before and don't know what I'm actually talking about I hope that aren't too many of you because you probably have seen vs code in most of my tutorials whenever I was editing any template files code or deployment stuff because vs code is a really great source code editor it's probably the most beloved tool by software developers and professional it guys and it's it's free it's built on open source software and it just runs everywhere so you can easily install that on Mac OS windows and Linux and you can also enhance this with third party plugins to extend the functionality so once you've installed that you can click on extensions here search in the marketplace and you can do some really great stuff with it I once did a video on some of the best vs code extensions that I'm using so I will link you that in the description you can still watch it there's some great stuff in here but today we are mostly focusing on how to extend vs code to make it a container management platform and the first extension I want to show you or it's actually a collection of three different extensions that is called remote SSH so you can install that along with those two other extensions remote SSH for editing configuration files and the remote Explorer because that allows you to easily open an SSH connection to any remote machine and use VSS code just like you would edit it on that remote machine it's pretty cool and that is also an extension that you are going to need if you want to manage containers on remote servers so like in a home lab we are often deploying virtual Linux machines or yeah servers where we are managing darker containers or running kubernetes clusters and so forth so that's why remote SSH you're going to need that a lot to upload any files to those remote servers but you can also use it to manage containers on those remote servers so that's a pretty useful extension that I'm using so many times in my projects once youve installed that you will see a window that is called remote Explorer so you can easily click on that and as you can see I've got a list with all my remote servers in here so those entries are usually coming from the SSH configuration file so if you've opened that file you can configure those remote entries in this text file here you just type in host and then the IP address or the fully qualified DNS name of your server you can even specify user and some other options like a specific private SS key pair that you always want to use when you're connecting to that remote server and so on that's of course Al the same progress as you would use in a terminal when you want to connect to a remote SSH machine but once you collect those entries to all your remote servers in this ss. SSH config file they will show up in this remote Explorer window and you can easily just select one of these entries here and open a new window to connect to this remote server either in that same window or you can open a new window so let me just demonstrate this when I open a connection to my production server here so you can see you need to authorize with an SSH key and then it's automatically opening a terminal on that remote machine and yeah you can just type in the terminal commands you can all see which containers you have deployed currently you can see there are a couple of containers that that are up and running and what is also great you can open a folder and that is then opening a folder on your remote server not on your local workstation and this is how I'm basically editing all my Docker compost files on the remote server like I'm managing those projects in uh folders in my personal home directory for example let's open this project here traffic production 4 so this is my reverse proxy that is a darker composed project you can see in this folder I have the doer compost. yo file and I can directly edit this file here make changes if I want to update that on my remote servers and then I can easily just manage the entire doer compos project in v code that's pretty cool the next extension that you're going to need to manage containers in vs code is obviously the docker extension so that will enhance vs code with many many features like build containers manage containers and even deploy the whole environment so that is really really great once you install that you will get a new icon in this window here when you click on that you can see there you can do all sorts of container management tasks yeah you can see all the running containers you can see all the images that you have done downloaded you can even connect Registries and manage Docker networks volumes and context so it really can do a lot for you and when you just open this locally you can see these are containers that are currently running on my Mac so when I open dock or desktop you can see all of the stuff that you see here is in line with what I'm deploying locally but now comes the big secret here because you cannot just use that to manage local environments you can also use that in combination with the remote Explorer to man Doo containers on your remote servers just over SSH this is so amazing let me quickly show you this and connect to one of my demo service so I'm just going to the remote Explorer and opening an SSH connection to this remote machine and now because I have installed the darker extension on my vs code I can now see that icon here as well click on that and as you can see I know can manage all the docker containers on my remote server this is so amazing so the usual workflow that I'm following here is whenever I'm managing projects on my remote servers I'm opening a remote SSH connection to my server I go into the project directory for example let's just open the traffic demo one project here and there I can manage the doer compos yaml file but now because I've installed the docker extension I can also do things like a right click on that Docker compos DML file run a compost up command or compose down restart for example when I recognize aut the traffic project has a new darker image with an updated version I can easily just connect to my remote server go in the project directory change the number here do a right click run a compose down run a compose up and that's it my container is now updated to the latest version I can now just click on that I can even open all the files inside the containers file system which is great for migrating uh configuration files or migrating data files you can easily just move them in and out of the container with vs code that's pretty cool and of course you can also do things like do a right click in here view all the logs so this will open a terminal window where it can troubleshoot certain things or you can inspect the Manifest of your darker container to get specific information about this you can even use that to manage remote Docker resources such as Docker networks for example yeah you can just click on that drop down menu here see all the different Docker networks that are currently existing on your remote server you can even create new once click on the plus icon give it a name select one of the three tires Bridge host or mag VLAN if then you've got created a new Docker Network on your remote host that's so easy you can even remove them here or inspect some of the details and you can also manage Docker volumes with it as you can see I've got created a couple of Docker volumes to store persistent data of my containers for the engine X proxy manager or for anible zema 4 and also manage those type of resources it's pretty useful so there are so many cool things that you can just do in vs code to manage containers on your remote server why the hell do I need any other tool where I first need to open a web browser to lock into a web UI then fiddle around with the specific workflows of that tool to do those simple tasks that I can literally just do in one or two seconds when I'm using my code editor for doing anything so that is the reason why I decided to mostly just use VSS code to manage my darker containers but wait it gets even better because vs code ALS has some really great features for managing workloads in kubernetes especially for troubleshooting but also quickly editing mans deploying manifest and so on I'm going to show that to you right now the first extension that you're going to need for this is called kubernetes it's kind of obvious as you can see it's not that hard to find those extensions you just need to know that they are existing and how to use them and this is also coming from Microsoft and enhancing vs code with many many capabilities and features around container orchestration workloads like you can manage kubernetes clusters with it do other devops tasks like troubleshooting and things manage Azure mini Cube AWS or gcp clusters and you can even manage some Helm repos with that once you install that you get another icon in here and when you open this no this is not meant to work in combination with remote SSH like Docker because managing kubernetes clusters this is all done locally you also need to install the cube CDL tools and configure the kubernetes context I've explained this in a bit more detail in how to deploy a simple kubernetes cluster using k3s in my k3s tutorial so I will link you that in the description down below just use it to deploy a kubernetes cluster somewhere you can also use dock or desktop to deploy a local kubernetes cluster to play around with that and so on and then use this extension to manage some container workloads on that so first of all you need to select a kubernetes context yeah just like I said you need to configure that and then do a right click on this and set it as a current cluster this is by the way also in line with what you have configured in your terminal so when you're changing the kubernetes context in your terminal with Cube CDL then it's also switching that in vs code so this is kind of using Cube CDL in the back end and you can even see and inspect some Helm reposts that you have downloaded on your local workstation so for example you can go in here and see uh all the different Helm chart versions of traffic you can even inspect the chart if you want to get some details about this if you really need that or what I find extremely useful is patch values so then you get a template for all the default values in the helm chart so this is so useful if you want to customize your Helm deployments and you don't need to search for that on Google somewhere you just got it right in your code editor that's really great and of course you can manage your kubernetes clusters with that so once you select selected a current context or you got that somehow enabled in your terminal you can just click on that drop- down menu and then you can open some specific resources in your kubernetes cluster such as Nam spaces you can see all these different Nam spaces and you can also switch to that namespace again also in line with what you do in a terminal for example yeah let's pick traffic again as a an example if you just click on that it will open the Manifest and you can directly edit it in here if you need too but you can also use the namespace to see more resources in that namespace for example if you want to see all the different pots in that namespace you can just click on workloads and then you can open the pots here and then it will show you all the pods in the namespace that you have currently selected you can also just click on that and it will show you the Manifest of that specific P now you can also do other cool things like click on that drop down men you see the IP address and so on you also got some small icons on the right side this is how you can easily inspect all the locks you just need to click on run and then you can use this for troubleshooting and so on you can even open a remote shell inside this pot here so click on Terminal and this will again open a terminer and we are now inside the container's fight system this is also great for troubleshooting and so forth but of course you can also do other things like inspecting the deployment like the the deployment for the traffic reverse proxy this this is what I've deployed on my kubernetes cluster or do the same with stateful set demon sets jobs and yeah you also got other resources like Network Services so this is for the load balancing part and so on you can even see custom resources in here for example for POA I've created an a traffic Ingress object in here and you can find it in the custom resources here search for Ingress routes and yeah I created an Ingress route TCP for exposing this servers with trusted TLS certificates and I even added a TLS pass through for connecting my main poer instance to that agent so you can do so many cool things and really use VSS code as a feature-rich container orchestration management platform this is so amazing what you can also do is you can inspect some of the helm releases you have used to install for example I probably have install traffic using a Helm chart so once you switch to that namespace you can see now the resources in that space get visible in here and you can see that is one of the hel charts that I've deployed with all of the details and uh the configuration stuff so really amazing and you can even do things like roll back to older deployments if you got something wrong in an update and so on and this is even much more that you can do in pora for example pora doesn't have all these different features so even a tool that is solely created for container management has sometimes not so many features as and vs code extension and again it's all in a code editor you can even deploy your kubernetes manifest with that you usually would follow a different workflow than creating darker composed templates and so on but I will quickly show you what I mean right so for example when I go into my home lab project so this is where I'm storing most of my deployments in my home lab such as darker compos file but also kubernetes manace for example for ptena I've got this Ingress route here and I want to update this right so how do I do this I can just easily edit this in vs code and change certain things that I want to change and then apply this with Cube CDL so you would probably assume that the kubernetes extension in vs code would have something like when you make a right click that it suggest to apply those changes but that's not happening here because you need another extension for that and this extension is called kubernetes apply so this is no official extension it's a very small one that probably not so many people are using but once you install that it will offer you this ability to go to a manifest and do a right click to apply the resource one thing that is a bit weird to make this work you need to rename those files from yml to yl so that's a bit weird but once you rename this and you're using the right extension you can see there is a new menu point in here that's called K kubernetes apply resources and when you click on this you need to open a terminal first I probably should also switch to the right uh context because this is what I've deployed on my production cluster of course so let's go in here set the current cluster to production and I also need to use the correct namespace of course so this is in the painer Nam space first of all let me uh check if the resource is already existing so this is a resource that is currently deployed on my cluster so let's go back to my folder uh to the Manifest let's do right click and apply resource you can see it just executes the cube CDL apply command and as you can see yeah that got updated now and this is really so easy yeah it's really a streamlined workflow to manage container platforms to manage container resources on Docker kubernetes even on remote servers where using Docker with just one single tool which is vs code you don't need anything else you don't need Pera you don't need Rancher you probably just need some terminal tools and a code Editor to make this all work and for me honestly this is the simplest fastest and easiest workflow that I'm using to deploy resources in my home lab yeah so if you want to try that out just get vs code if you haven't already downloaded it install the right extensions that I've shown you in this video and start managing your home lab resources and container workflows with a code editor it's pretty cool again I don't want to say that you need to quit using paina Rancher and all those other tools would be crap or something similar no those tools are still great but I would definitely say that for everyone there's the right tool and you really need to find out so what tool fits your workflow and what specific specific requirements do you have which tool fits that better and for me personally it's just vs code because I can do literally 90% of all the work that I'm doing to deploy container workloads with this tool so that's probably the best thing for me but yeah just tell me what do you think are you surprised of all the capabilities of V code or did you learn something new please leave me a comment many many thanks for watching don't forget to hit the like button and subscribe to the channel if you want to see more content for it professionals and hom lab enthusiast and if you enjoy all those free tutorials that I'm creating why not consider joining our patreon program I recently added a couple of nice benefits to all the patreon members like early access at free viewing on patreon an exclusive member chat on Discord so join and let's have a chat about it I love to hang out with you guys and talk about those Tech topics and thanks again for watching I will catch you in the next one take care bye-bye
Info
Channel: Christian Lempa
Views: 16,126
Rating: undefined out of 5
Keywords:
Id: huiQd2QojXY
Channel Id: undefined
Length: 21min 53sec (1313 seconds)
Published: Wed Nov 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.