(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, I'm 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 don't recommend using minikube
to build a production Kubernetes environment,
but it's 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 don't 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 we're gonna be going through in order to set up
our local Kubernetes cluster with minikube.
First, we're going to install a container runtime
so that we can run minikube itself inside of a container,
and I'll be using Podman for that purpose,
but you can use other tools like Docker
or even a virtualization tool like Virtualbox.
Then we're going to install kubectl.
That's a command line tool that we can use
to interact with our Kubernetes cluster
once it's up and running.
After that, we'll go ahead and install minikube,
and then finally we'll use minikube
to create our local Kubernetes cluster.
So let's go ahead and jump in to our demonstration.
(upbeat music) (keys clacking)
So for this demo,
I'm 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,
I'm just gonna put dot and then a space
followed by slash etc slash os dash release.
And what that's 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 I'm gonna do.
Next, I'll go ahead and add the kubic repositories
to my server here.
So I'm basically just going to add this line
and that's referencing this environment variable
with some information
about our current operating system version.
So I'm 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 I'm 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 I'm 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 I'll do sudo apt get dash y upgrade.
(upbeat music)
Now that the upgrade is complete,
I'm ready to go ahead and install Podman.
So I'll 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 I'll do sudo vi sudo, edit my sudoers file,
and I'm gonna come down here just to the end of the file.
It doesn't really matter where I add this,
but I'm just gonna do it at the end.
And I'm gonna add sudoers access to cloud user
'cause that's my username.
So there's my username there,
and I'm basically going to allow this user
to access user slash bin slash Podman.
So I'm just giving my user sudo access
to use the Podman executable there.
So I'll go ahead and save and exit that file.
Now that I have Podman installed and configured,
I'm ready to move on to the next step,
which is to install kubectl.
(upbeat music) (keys clacking)
That's gonna be our tool that we'll use
to interact with the Kubernetes cluster
right here from the command line.
So first I'm gonna go ahead
and just download the kubectl binary,
and then I'll install the binary.
I'll give it the root user
as well as the root group, permissions 0755,
and we're just gonna install that kubectl executable
in user local bin kubectl.
So now I should be able to test kubectl.
I'm 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,
I'm gonna get this message here
when kubectl tries to get the version information
for the Kubernetes cluster itself
and that's because we haven't actually
created our cluster yet.
But so far, we do have kubectl working,
and we're ready to go ahead and install minikube.
(upbeat music) (keys clacking)
So I'll just use curl to download the minikube executable,
and then I'll just do sudo install
to go ahead and install that executable,
and I'm gonna install it in user local bin
and I'll 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 it's 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 there's my client version information
and there's the server version,
which is coming from my Kubernetes cluster.
So I am able to communicate with my cluster using kubectl.
That means I've successfully
built a local Kubernetes cluster using minikube.
So that's it, we've 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,
that's a great place to get started.
I've 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,
we'll see you next time.