# Kubernetes provision for Provisioning tasks

<img src="images/Kubernetes_logo.svg" width="500">

Basic installation for [Kubernetes](https://kubernetes.io) from file settings declaration using [cri-0](https://cri-o.io/) as [CRI](https://kubernetes.io/es/docs/concepts/architecture/cri/) and [cilium](https://cilium.io/) as [CNI](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) 

## Addons

- [Istio](https://istio.io/)

## File layout:

```bash
.
├── README.md
├── default
│   ├── addons
│   │   └── istio
│   │       └── install.sh
│   ├── cni
│   │   └── cilium
│   │       └── install.sh
│   ├── cri
│   │   └── crio
│   │       ├── crictl.yaml
│   │       └── install.sh
│   ├── env-kubernetes.j2
│   ├── install-kubernetes.sh
│   └── templates
│       └── kubeadm-config.yaml.j2
└── images
    └── Kubernetes_logo.svg

```

## Profile "default"  

### install-kubernetes.sh

[install-kubernetes.sh](install-kubernetes.sh) will run OS update, install additional packages and finall call [kubernetes install-kubernetes.sh](kuberenetes/install-kubernetes.sh) with provided argumentes

install-kubernetes.sh full-path-settings-file [ -m controlplane (hostname -cp-) | worker]  [install | update | makejoin | remove | fullremove]

Full path is required for settings-file as tasks will be executed inside [kubernetes directory](kubernetes) 
Settings-file name should include word 'setting' in filename
Example: ./install-kubernetes.sh $(pwd)/k8s-settings


### Kubernetes install

[kubernetes install-kubernetes.sh](kubernetes/install-kubernetes.sh) can be invoked by itself 

install-kubernetes.sh full-path-settings-file [ -m controlplane (hostname -cp-) | worker]  [*install | update | makejoin | remove | fullremove]

### List of tasks: 

- Update OS
- Check hostname resolution
- Adjust apt respositories
- Install [Kubernetes](https://kubernetes.io) [CRI](https://kubernetes.io/es/docs/concepts/architecture/cri/) 
- Download [kuberenets](https://kubernetes.io) packages
- Fix ip forwarding
- Turn off swap 
- Create config file for kubeadm
- Install [kubernetes](https://kubernetes.io): control-plane, worker
- Install [Kubernetes](https://kubernetes.io) [CNI](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) (only control-plane)
- Install Addons (only control-plane) [Istio](https://istio.io/)
- Manage [join token](https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/) to existing cluster
- Collect logs and infos

