Create a single node Kubernetes cluster with kubeadm and Ansible. Then, deploy Caddy to demonstrate that we can host a simple static website on the cluster.
-
Install CentOS 7 on the target host.
-
Establish SSH access from the Ansible control node to your host.
-
Use Ansible to provision the host.
# Save the host connection details. echo "<ip-addr>" >> hosts # Create virtual environment with Ansible. python3 -m venv .ansible source .ansible/bin/activate pip install ansible # Run the playbook. ansible-playbook --ask-become-pass --inventory hosts playbook.yml
-
Browse to
http://<ip-addr>:30080/
. You should see the Caddy welcome page.
This section includes some special considerations for offline installations.
List images that kubeadm requires.
$ kubeadm config images list
k8s.gcr.io/kube-apiserver:v1.18.5
k8s.gcr.io/kube-controller-manager:v1.18.5
k8s.gcr.io/kube-scheduler:v1.18.5
k8s.gcr.io/kube-proxy:v1.18.5
k8s.gcr.io/pause:3.2
k8s.gcr.io/etcd:3.4.3-0
k8s.gcr.io/coredns:1.6.7
List and retrieve Calico images.
$ calico_version=v3.14
# List images that this version of Calico requires.
$ curl -s https://docs.projectcalico.org/${calico_version}/manifests/calico.yaml | grep image | awk '{print $2}' | sort | uniq
calico/cni:v3.14.1
calico/kube-controllers:v3.14.1
calico/node:v3.14.1
calico/pod2daemon-flexvol:v3.14.1
# Pull all the Docker images for Calico.
$ images=$(curl -s https://docs.projectcalico.org/${calico_version}/manifests/calico.yaml | grep image | awk '{print $2}' | sort | uniq)
$ for image in $images; do sudo docker pull "$image"; done