Kubernetes
As we ran into several problems with the deployment of docker-compose, when we introduced our second root server Stratholme, we want to migrate to Kubernetes, or more precisely to k3s, a lightweight Kubernetes-distribution. We have a Jour fixe to work on this every monday at 7pm CEST/CET.
resources
pod
pods are more-or-less equivalent to containers
deployment
A deployment creates a replica-set, that can consist out of several pods. Deployments can be used for stateless services, e.g. our website. Services that are not stateless can be deployed with statefulsets
StatefulSet
Statefulsets will start pods, similar to deployments, but will also create a new volume for each new pod and automatically mount the respective volumes on pods that have been restarted.
persistentvolume
persistentvolumes are usually automatically created, when a persistentvolumeclaim is being created.
persistentvolumeclaim
Persistentvolumeclaims relate pods to persistentvolumes. They are usually automatically created when a pod needs a volume.
files
kubeconfig.yml
k9s tools read a configuration file that has to be specified via the environment variable KUBECONFIG
.
Each cluster requires an own kubeconfig.yml
manifest files
manifest files can be yml or json, but yml is preferred by us and generally are more common.
a manifest file defines one or more resources. If you want to declare more than one resource in a single manifest yaaml, you can use multiple yaml documents , that can be split via ---
.
You could for instance declare a persistentvolumeclaim and a deployment in the same file.
Each resource requires at least the following attributes:
apiVersion
As of June 2020, this should always be apps/v1
kind
The kind attribute specifies, which kind of resource is being declared.
metadata
Within the metadata attribute there should at least be a name
attribute, that gives the resource a meaningful name.
spec
Additional Specs of the resource can be specified within the spec attribute.
tools
kubectl
kubectl is the tool to apply changes to