Skip to content

Terraform configuration for deploying Nginx ingress controller in a Kubernetes cluster

License

Notifications You must be signed in to change notification settings

Wi3ard/k8s-nginx-ingress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx ingress controller for Kubernetes

Terraform configuration for deploying Nginx ingress controller in a Kubernetes cluster

Features

  • GKE support.
  • Automatic DNS management using Google Cloud DNS.
  • Let's Encrypt wildcard certificate generation using cert-manager.

Before you begin

The following prerequisites need to be installed and configured:

GCE configuration

GOOGLE_APPLICATION_CREDENTIALS environment variable must be configured to point to GCE JSON key file. For example (PowerShell):

$env:GOOGLE_APPLICATION_CREDENTIALS = "C:/mykeys/gce-default.json"

Terraform initialization

Copy terraform.tfvars.example file to terraform.tfvars and set input variables values as per your needs. Then initialize Terraform with init command:

terraform init -backend-config "bucket=$BUCKET_NAME" -backend-config "prefix=apps/$CLUSTER_NAME/nginx-ingress"
  • $REGION should be replaced with a region name.
  • $CLUSTER_NAME should be replaced with the name of a cluster.
  • $BUCKET_NAME should be replaced with a GCS Terraform state storage bucket name.

Installation

To apply the Terraform plan, run:

terraform apply

Uninstall and cleanup

To remove the Terraform plan, run:

terraform destroy

The cert-manager Helm chart included in this plan creates several Custom Resource Definitions that have to be deleted manually:

$ kubectl delete crd certificates.certmanager.k8s.io -n kube-system
customresourcedefinition.apiextensions.k8s.io "certificates.certmanager.k8s.io" deleted

$ kubectl delete crd clusterissuers.certmanager.k8s.io -n kube-system
customresourcedefinition.apiextensions.k8s.io "clusterissuers.certmanager.k8s.io" deleted

$ kubectl delete crd issuers.certmanager.k8s.io -n kube-system
customresourcedefinition.apiextensions.k8s.io "issuers.certmanager.k8s.io" deleted

About

Terraform configuration for deploying Nginx ingress controller in a Kubernetes cluster

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published