In-depth set-up

Example kubernetes manifests are provided for usage in a testing or in a production environment.

Sample manifests and ansible scripts are provided in the infrastructure repository. The sample YAML files can (and should) be customized to fit specific installation scenarios. As of now, they require Persistent Volumes to be available somehow to the cluster.

Starting a mini-kubernetes cluster

You can use the Ansible script templates in k8s-small-cluster-centos-ansible/ to setup a small k8s cluster with CentOS 7 machines.

To use that, please add the relevant IP addresses in the inventory.txt file and then run through the three playbooks.

Once the playbooks are completed and any errors sorted out, the Master can be started. First you may need to set the names and ip addresses of all the cluster participants in Master’s /etc/hosts, and then initialize the cluster:

# kubeadm init
# mkdir -p $HOME/.kube
# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# chown $(id -u):$(id -g) $HOME/.kube/config
# export kubever=$(kubectl version | base64 | tr -d '\n')
# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"

This should initialize the master node and the weave network. Take note of the command output from the first command.

Execute the kubeadm join command on all the workers, using the parameters printed out from the kubeadm init command on the Master.

Starting a Movens installation

These steps expand on the ones outlined in the Quickstart.

From a Kubernetes master, please create any required secrets (e.g. for pulling docker images), then customize and load the configmap like this:

$ kubectl create -f movens-config.yaml

Once the secrets and the config map have been created, apply the deployment:

$ kubectl apply -f movens-allinone.yaml

If you plan on using this in production, consider removing the PostgreSQL pods and replace them with a solid psql server instance, maybe on bare metal. Also consider some S3-compatible storage solution, and SMTP servers. Check the configuration map source for further information.

Exposing services

To expose services install nginx-ingress in the cluster. This can be easily done via helm after setting up the permissions for your user:

$ kubectl create clusterrolebinding cluster-admin-binding \
    --clusterrole cluster-admin \
    --user email@example.com

Add the Google kubernetes repository to your helm repo list:

$ helm repo add REPO_NAME https://kubernetes.github.io/ingress-nginx

To install nginx-ingress use:

$ helm install movweb REPO_NAME/ingress-nginx

Apply the supplied NGINX configuration (to disable proxy buffering):

$ kubectl apply -f nginx-ingress-config.yaml

Create the Movens Ingress object:

$ kubectl apply -f movens-ingress.yaml

To provide HTTPS, cert-manager can be used (from https://docs.cert-manager.io). To install please follow steps 5 to 7 from https://docs.cert-manager.io/en/latest/tutorials/acme/quick-start/index.html. Part of the required configuration is already set up in the movens-ingress.yaml, le-staging.yaml and le-prod.yaml files. Remember to edit the files to uncomment annotations and tls section, and to set your host address and registration e-mail