Deploying Postgres in Kubernetes with Ansible

A PoC for basic Kubernetes API calls.

- 1 min read

Series: Labs

Laboratory

Even tho Kubernetes allows to deploy production-grade databases, it is possible to deploy a straightforward Postgres instance without operators or major architecture designs. Of course, this won’t be suitable for a production setup, but is good enough for understanding the concepts behind k8s API calls.

See the source: Postgres deployment on k8s using Ansible

Install minikube or similar

Minikube

curl -Lo minikube \
  https://storage.googleapis.com/minikube/releases/v1.2.0/minikube-darwin-amd64\
  && chmod +x 
minikube && sudo cp minikube /usr/local/bin/ && rm minikube

Getting the token

Access Kubernetes API

Ansible k8s

Ansible k8s module

K8S_AUTH_API_KEY in environment.

Getting facts with k8s_fact

k8s_fact


comments powered by Disqus