Hello,
and a big warm welcome to you to this Pluralsight
presentation where we go through and take a look at managing
container microservices using Kubernetes.
My name is Andrew Mallett,
and I'm going to be instructor to guide you through this module,
a module where we're going to understand a little bit
more about Kubernetes and microservices.
We'll be looking at how they add scalability and
reliability to your straightforward containers,
and we'll look at things called deployment.
A deployment is going to consist of one or more Pods,
and we can make them into microservices by assigning IP addresses,
usually by exposing ports in those services.
We begin by talking a little bit about Kubernetes.
Kubernetes itself will add clustering support to
your container‑based applications.
This is going to add reliability and, of course,
the ability to scale your services to meet demand.
We're going to be installing Kubernetes through MicroK8s on Ubuntu 20.04.
MicroK8s is a CNCF, Certified Cloud Native Foundation,
we have it there in the text for you, upstream Kubernetes deployment.
Now the idea of using this is it allows us to install
Kubernetes onto a single node system,
although very often you'll want to be installing it across multiple nodes
to give us that reliability in case of node failure.
MicroK8s is available as a snap, so we can use the snap install.
We need to add our user through to the microk8s group
once the installation is complete.
And, of course,
we'll need to log out and log back in again to pick up that group membership.
But once we've logged back in again,
we can go through and check the status of our cluster,
and we can go through and see it from the Kubernetes
point of view by using the get all.
Now this then seems like a very good time to dive out to our
command line for our first demonstration.
So working on our Ubuntu 20.04 system,
we're going to be able to install MicroK8s,
add our user to the group, and then verify our cluster status.
So here we are on our Ubuntu 20.04 system,
and if we go through and use a free ‑h,
we should be able to see that I'm using 3.8 GB of RAM on this system.
If you're using the same Vagrantfile, you should have something similar.
Now we don't necessarily need all of that 4 GB of RAM,
but, of course, we are going to be using a little bit of resources on our system.
We're going to make sure then that we have got our Kubernetes installed,
and we're installing it via MicroK8s.
So we can use our sudo and snap install microk8s and just
using the classic installation method.
And then, of course,
rather than having to enjoy the installation screens of
APT that we've become so used to, we can enjoy the installation screen of Snap.
Snap is a package manager that's been available in
Ubuntu since about Ubuntu 18.04.
It's similar to any other package manager,
but it ends up downloading disk files and then mounting those
disk files and using the files from that Snap.
So it's a very different way of managing your software install and making it
very easy to be able to remove it once you're finished.
With the installation up and running,
we can go through and use our sudo gpasswd ‑a to add our current users.
In my case, it's a Vagrant user,
but we need to add it through to the microk8s group.
So that's all up and running now, but let's just log out, log back in again.
Of course, we need to do this to pick up our group membership.
But if I now go through and run the id command,
we should be able to see that we're a member of that group.
As a member of that group, we can go through and run our microk8s and status,
and we can see then the status of our cluster.
So we've only got the one node added in, and that's just our master node.
We have also other features that we could enable.
As we go through and look,
we can enable things like the dashboard or a DNS service,
or we can go through and add in our own local registry for images.
We'll leave it as it is for the moment,
and all we've got running then is just the high availability cluster.
But don't forget we can always look at this from the Kubernetes point of view.
By running microk8s and then the kubectl command,
we can go through and use get all so we can see all of the resources are in use,
and we can see there that we've got our cluster service and the
cluster IP address that's been assigned to it.
So our cluster service is up and running and with a master node.
We're just about ready to go.
But before we go,
let's just clear our screen for a moment and just step back to take
a look at the idea of Snap software installs.
When we looked at a Snap software install,
what actually happened is we downloaded a disk file,
and we mounted that disk file.
We can see that this file is shown as loop4 here,
a loopback device, and we can see that's 219 MB,
and it's mounted through to the snap and microk8s/3272 directory in our case.
The resources that we need to run MicroK8s are going to come from that disk
file system, so very different to what we're normally used to.
But again, it's a little bit of interest, a little bit of, if you like,
the background information of what goes on in Ubuntu. But anyway,
we're here to look at MicroK8s and Kubernetes, and we're going to look in our
next clip at how we go through and create our own microservice and have a web‑based microservice up and running in Kubernetes.