The following configuration will deploy a [Linode](https://linode.com) Kubernetes Cluster and NodeBalancer with Terraform, install the necessary Kubernetes resources to serve a static website, and deploy a [Jekyll](https://jekyllrb.com/) site using Helm.
The jekyll site provided in this repo is an example and includes a basic Dockerfile and script for building and pushing the images to Dockerhub.
## Usage
### Hard-mode
#### Infrastructure
1. Clone the repo.
2. Edit the values in `.envrc` to values appropriate for your project. Run `direnv allow` once set.
# The DockerHub repo associated with the image to build.
export IMGREPO=
# The Linode API key of the account to create the resources.
# Storing API keys for an account in this fashion is _NOT RECOMMENDED_! Consider using a secrets manager to store this value locally for your project (i.e. doppler).
export TF_VAR_token=
# This file is created automatically when the infra is created in Terraform.
export KUBECONFIG=./.kube-config
3. Change to the `/terraform` directory and create the LKE cluster.
terraform apply
4. Once the infrastructure has been created, change directory to the root of the project `cd ..` and check Kubernetes connection.
kubectl get namespaces
5. Apply the Kubernetes manifest configurations for necessary services. **_Apply in order!_**
1. If not using _latest_ as your image tag, set the new image version tag using `appVersion` in `/charts/site/Chart.yaml`. _This may also be set by using `image.tag` in `/charts/site/values.yaml` or `/charts/site/override.yaml`._
2. Use `/site/deploy/docker.sh` to build the new image.
- If the NGINX Ingress Controller is not destroyed prior to destroying the infrastructure using Terraform, the Linode NodeBalancer will continue to exist within the account. This must be deleted manually. Automation for this process will come with a new version of this project.
- The kube-config only works properly in the root directory.
- Automation for the entire infra build process.
- Image tags need an env var.
- Helm should use env vars to identify new for deployment.
- CertManager Helm flag did not generate namespace as indicated in the docs. This step had to be manually added to `cert-manager-v1.7.2.yaml`. This will be a problem for upgrading in the future.