- In this video, you will learn how to use Ansible
to run Kubernetes resources
in an already existing Kubernetes cluster.
I do expect that you have worked your way
through lesson 19.3 and lesson 19.4
to set up a Kubernetes cluster
before going into the procedure described here.
So what is involved?
Well, after setting up the cluster,
you first need to create
Kubernetes infrastructure components
and next start running the deployments and/or Pods
and we are ready to do so at this moment.
You can use Ansible Collections to do so.
And in order to make it easy to understand what is going on,
I created two playbooks.
And you know what?
Let's just go check out these playbooks, run them
and see how successful they are.
Now that we have our Kubernetes cluster up and running,
let's create some resources.
So there we go, and what do we see?
A very simple playbook that runs on local host
that is running k8s.
K8s is the Kubernetes model, the default Kubernetes model.
And in this default Kubernetes model, it is creating a port.
Our first port namespace: default,
containers: utilitypod, image: nginx
You know what?
That is completely alright with me.
You don't need it to be any more fancy for a first try.
This is good enough.
Do have a look at what is happening
in this Kubernetes module.
This Kubernetes module is containing
the straight API specification.
You need to know a bit about Kubernetes
to understand what is going on here.
And if you don't know about Kubernetes, just take it.
This will create a bot and a bot will run a container.
If you do know, then you can see it's creating
the bot resource using the nginx image,
creating a container utilitypod with a container name,
and the bot name is ourfirstbot in the namespace: default.
This is as easy as you can make it for yourself.
So, use ansible-playbook create-pod.yaml
and see what is going on.
And yay! Create a pod.
It's telling us change local host.
So kubectl get all is doing what?
It is giving us a status of container creating.
So that is what is going on.
So Ansible playbook create pod,
also a very simple playbook that allows you to create bots
in your freshly installed Kubernetes cluster.
But hey, we shouldn't get any further here.
This is showing you how to work in Kubernetes
and everything else, well, I would say good luck
applying your Kubernetes knowledge
to this newly installed Kubernetes cluster.