Skip to content

blachniet/ansible-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Kubernetes

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.

  1. Install CentOS 7 on the target host.

  2. Establish SSH access from the Ansible control node to your host.

  3. 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
  4. Browse to http://<ip-addr>:30080/. You should see the Caddy welcome page.

Offline

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

Links

About

Create a single node Kubernetes cluster with kubeadm and Ansible.

Resources

Stars

Watchers

Forks

Languages