Deploying applications to Kubernetes using Ansible
Containerized applications can be deployed inside Kubernetes via the Kubernetes dashboard (web UI) or using the kubectl
CLI (https://kubernetes.io/docs/reference/kubectl). By using Ansible, we can automate most of the deployment operations that take place inside our Kubernetes clusters. Since Ansible can easily integrate within CI/CD pipelines, it is possible to achieve more control over your application deployments in a containerized environment such as Kubernetes.
Applications are deployed inside logical isolated groups called Kubernetes namespaces. There can be default namespaces and Kubernetes cluster-related namespaces, and we can also create additional namespaces as required to deploy applications. Figure 11.16 demonstrates the relation between Deployments, Pods, Services, and namespaces in a Kubernetes cluster:
Figure 11.16 – Kubernetes Deployments and namespaces
In the following exercise,...