Creating a Kubernetes Cluster with Minikube - read the full article about Kubernetes tutorial, IT Consulting and from A Cloud Guru on Qualified.One
(upbeat music) Kubernetes is one of the most popular tools for managing containers and container based applications.
It can help you easily manage even a large and complex infrastructure for applications that are running inside containers.
So in this video, Im gonna be showing you how to create a local Kubernetes cluster using minikube.
(upbeat music) (keys clacking) Minikube is a tool that makes it easy to create a local Kubernetes cluster.
I dont recommend using minikube to build a production Kubernetes environment, but its great to get that local Kubernetes environment up and running for development and experimentation.
(upbeat music) (keys clacking) A production Kubernetes cluster usually has multiple servers or nodes which are used to run your actual containers.
But with minikube, we just want a simple, easy local environment.
We dont need multiple servers.
So what minikube does is it allows us to create that compact single node Kubernetes cluster quickly and easily.
Minikube simplifies the process of creating these local clusters by running inside of a container itself or inside a virtual machine if you choose.
(upbeat music) (keys clacking) So before we get started, these are the four basic steps that were gonna be going through in order to set up our local Kubernetes cluster with minikube.
First, were going to install a container runtime so that we can run minikube itself inside of a container, and Ill be using Podman for that purpose, but you can use other tools like Docker or even a virtualization tool like Virtualbox.
Then were going to install kubectl.
Thats a command line tool that we can use to interact with our Kubernetes cluster once its up and running.
After that, well go ahead and install minikube, and then finally well use minikube to create our local Kubernetes cluster.
So lets go ahead and jump in to our demonstration.
(upbeat music) (keys clacking) So for this demo, Im gonna be using a basic Ubuntu 20.04 server, and my first step here is gonna be to install Podman, which is gonna be used as the container runtime to run minikube.
So for my first command, Im just gonna put dot and then a space followed by slash etc slash os dash release.
And what thats gonna do is just load some version information for the current operating system into some environment variables so that I can reference those in some of these commands that Im gonna do.
Next, Ill go ahead and add the kubic repositories to my server here.
So Im basically just going to add this line and thats referencing this environment variable with some information about our current operating system version.
So Im gonna add this line to my sources list.
So essentially that will add that package repository to the list so that I can use it to install Podman here in a moment.
And I also need to add the GPG key for that repository, so Im just gonna download GPG key here and then pass it to sudo apt key add.
So now I have my package repository set up, and Im going to do a sudo apt get update to update my package listings, and Podman does recommend that I do an upgrade as well, so Ill do sudo apt get dash y upgrade.
(upbeat music) Now that the upgrade is complete, Im ready to go ahead and install Podman.
So Ill do sudo apt get dash y install on the Podman package.
And now I just need to make sure that my user has sudoers access to interact with Podman.
So Ill do sudo vi sudo, edit my sudoers file, and Im gonna come down here just to the end of the file.
It doesnt really matter where I add this, but Im just gonna do it at the end.
And Im gonna add sudoers access to cloud user cause thats my username.
So theres my username there, and Im basically going to allow this user to access user slash bin slash Podman.
So Im just giving my user sudo access to use the Podman executable there.
So Ill go ahead and save and exit that file.
Now that I have Podman installed and configured, Im ready to move on to the next step, which is to install kubectl.
(upbeat music) (keys clacking) Thats gonna be our tool that well use to interact with the Kubernetes cluster right here from the command line.
So first Im gonna go ahead and just download the kubectl binary, and then Ill install the binary.
Ill give it the root user as well as the root group, permissions 0755, and were just gonna install that kubectl executable in user local bin kubectl.
So now I should be able to test kubectl.
Im just gonna do kubectl version, which is gonna list the version information for kubectl, so I did successfully get my client version, but at this point, Im gonna get this message here when kubectl tries to get the version information for the Kubernetes cluster itself and thats because we havent actually created our cluster yet.
But so far, we do have kubectl working, and were ready to go ahead and install minikube.
(upbeat music) (keys clacking) So Ill just use curl to download the minikube executable, and then Ill just do sudo install to go ahead and install that executable, and Im gonna install it in user local bin and Ill just call it minikube.
(upbeat music) (keys clacking) And now all I need to do in order to create my Kubernetes cluster is just run the minikube start command.
And this will take a little time to complete, but once its done, we should have a working Kubernetes cluster.
So now minikube start is finished running and I should be able to run kubectl version and see both my client and server information.
So theres my client version information and theres the server version, which is coming from my Kubernetes cluster.
So I am able to communicate with my cluster using kubectl.
That means Ive successfully built a local Kubernetes cluster using minikube.
So thats it, weve successfully built a simple, easy local Kubernetes environment for development and experimentation.
You can interact with your Kubernetes cluster however you like, use it to run your container-based applications, or even build something new.
You can even create additional local Kubernetes clusters if you want separate environments for different projects.
Check out the official minikube website or the Kubernetes documentation to learn more about what you can do with these great technologies.
If you want to dive deeper into Kubernetes with A Cloud Guru, you might want to check out our Introduction to Kubernetes course, thats a great place to get started.
Ive added some links for you to find these documents alongside other useful resources, including a couple of free EKS and GKE courses currently available on A Cloud Guru But for now, if you enjoyed the video, please give it a thumbs up.
If you have questions or comments, add them below. We love to hear from you.
Thanks for watching, keep being awesome, well see you next time.
A Cloud Guru: Creating a Kubernetes Cluster with Minikube - IT Consulting