All Projects → GoogleCloudPlatform → gke-managed-certificates-demo

GoogleCloudPlatform / gke-managed-certificates-demo

Licence: Apache-2.0 License
GKE ingress with GCP managed certificates

Programming Languages

shell
77523 projects
python
139335 projects - #7 most used programming language
HCL
1544 projects
Makefile
30231 projects

Projects that are alternatives of or similar to gke-managed-certificates-demo

gke-anthos-holistic-demo
This repository guides you through deploying a private GKE cluster and provides a base platform for hands-on exploration of several GKE related topics which leverage or integrate with that infrastructure. After completing the exercises in all topic areas, you will have a deeper understanding of several core components of GKE and GCP as configure…
Stars: ✭ 55 (+161.9%)
Mutual labels:  gcp, gke, gke-helmsman
google-managed-certs-gke
DEPRECATED: How to use Google Managed SSL Certificates on GKE
Stars: ✭ 16 (-23.81%)
Mutual labels:  gcp, gke, ssl-certificates
gke-ip-address-management
An application to help with IP Address Management (IPAM) for Google Kubernetes Engine (GKE) clusters. Easily allows the calculation of the subnets required to spin up GKE clusters in VPC-native mode. See it at: https://googlecloudplatform.github.io/gke-ip-address-management/
Stars: ✭ 45 (+114.29%)
Mutual labels:  gcp, gke, gke-helmsman
gke-vault-demo
This demo builds two GKE Clusters and guides you through using secrets in Vault, using Kubernetes authentication from within a pod to login to Vault, and fetching short-lived Google Service Account credentials on-demand from Vault within a pod.
Stars: ✭ 63 (+200%)
Mutual labels:  gcp, gke, gke-helmsman
k8s-digester
Add digests to container and init container images in Kubernetes pod and pod template specs. Use either as a mutating admission webhook, or as a client-side KRM function with kpt or kustomize.
Stars: ✭ 65 (+209.52%)
Mutual labels:  gcp, gke
gke-datadog-demo
This project demonstrates how a third party solution, like Datadog, can be used to monitor a Kubernetes Engine cluster and its workloads. Using the provided manifest, you will install Datadog and a simple nginx workload into your cluster. The Datadog agents will be configured to monitor the nginx workload, and ship metrics to your own Datadog ac…
Stars: ✭ 21 (+0%)
Mutual labels:  gke, gke-helmsman
terraform-aws-acm-request-certificate
Terraform module to request an ACM certificate for a domain name and create a CNAME record in the DNS zone to complete certificate validation
Stars: ✭ 83 (+295.24%)
Mutual labels:  ssl, ssl-certificates
gke-demo
Demonstration of complete, fully-featured CI/CD and cloud automation for microservices, done with GCP/GKE
Stars: ✭ 47 (+123.81%)
Mutual labels:  gcp, gke
gke-rbac-demo
This project covers two use cases for RBAC within a Kubernetes Engine cluster. First, assigning different permissions to user personas. Second, granting limited API access to an application running within your cluster. Since RBAC's flexibility can occasionally result in complex rules, you will also perform common steps for troubleshooting RBAC a…
Stars: ✭ 138 (+557.14%)
Mutual labels:  gke, gke-helmsman
gke-istio-gce-demo
In this project, you will leverage Kubernetes Engine and Google Compute Engine to explore how Istio can manage services that reside outside of the Kubernetes Engine environment. You will deploy a typical Istio service mesh in Kubernetes Engine, then configure an externally deployed microservice to join the mesh.
Stars: ✭ 53 (+152.38%)
Mutual labels:  gke, gke-helmsman
private-tls-cert
A simple Terraform module to generate self-signed TLS certificates for private use
Stars: ✭ 36 (+71.43%)
Mutual labels:  ssl, ssl-certificates
gke-istio-telemetry-demo
This project demonstrates how to use an Istio service mesh in a single Kubernetes Engine cluster alongside Prometheus, Jaeger, and Grafana, to monitor cluster and workload performance metrics. You will first deploy the Istio control plane, data plane, and additional visibility tools using the provided scripts, then explore the collected metrics …
Stars: ✭ 55 (+161.9%)
Mutual labels:  gke, gke-helmsman
docker-nginx-certbot
Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.
Stars: ✭ 367 (+1647.62%)
Mutual labels:  ssl, ssl-certificates
Networking-and-Kubernetes
This is the code repo for Networking and Kubernetes: A Layered Approach. https://learning.oreilly.com/library/view/networking-and-kubernetes/9781492081647/
Stars: ✭ 103 (+390.48%)
Mutual labels:  gcp, gke
cryptonice
CryptoNice is both a command line tool and library which provides the ability to scan and report on the configuration of SSL/TLS for your internet or internal facing web services. Built using the sslyze API and ssl, http-client and dns libraries, cryptonice collects data on a given domain and performs a series of tests to check TLS configuration…
Stars: ✭ 91 (+333.33%)
Mutual labels:  ssl, ssl-certificates
Ssl exporter
Exports Prometheus metrics for SSL certificates
Stars: ✭ 211 (+904.76%)
Mutual labels:  ssl, ssl-certificates
inspec-gke-cis-benchmark
GKE CIS 1.1.0 Benchmark InSpec Profile
Stars: ✭ 27 (+28.57%)
Mutual labels:  gcp, gke
Lemur
Repository for the Lemur Certificate Manager
Stars: ✭ 1,533 (+7200%)
Mutual labels:  ssl, ssl-certificates
Certbot Route53
Helping create Let's Encrypt certificates for AWS Route53
Stars: ✭ 159 (+657.14%)
Mutual labels:  ssl, ssl-certificates
gtoken
Securely access AWS services from GKE cluster
Stars: ✭ 43 (+104.76%)
Mutual labels:  gcp, gke

Building Managed Certificates for your Kubernetes Engine Cluster

Table of Contents

Introduction

A Kubernetes Ingress manages external access to your services in a cluster. It's an object in Kubernetes which defines rules for routing external HTTP(S) traffic to applications running in a cluster. An Ingress object is associated with one or more Service objects, each of which is associated with a set of Pods. Ingress allows path and subdomain based routing to your backend services.

Additionally you can terminate TLS for your services through Ingress. While this usually requires you to create and manage your own certificates, GKE supports the use of Google managed certificates. This takes away the burden of manually requesting and managing SSL certificates to ensure secure connections to your services.

In this tutorial, we will go through how to use Google Cloud's new feature, Google managed certificates,to secure your Ingress in GKE.

Process

The diagram below summarize the steps to deploy an ingress using a Google managed certificate.

deployment process

Assumptions

This guide assumes you own a domain name with a valid DNS managed zone so we can use it to add a DNS record for the Ingress. If you currently own a domain name without a DNS managed zone, follow these instructions to create one in your project. You need to bring your own domain for this demo to work, as a valid SSL certificate requires a domain.

In this demo we will be using a managed zone called fakedomain-zone which contains all DNS records for the fakedomain.com domain. we chose the following url for our Ingress: heyingress.fakedomain.com. We will export those in environment variables later before we deploy the demo. You will need to replace those values with your own domain name.

Prerequisites

In order to complete the steps outlined below, several tools must be installed and have the proper configuration of authentication in order to access your GCP resources.

Cloud Project

You will need access to a Google Cloud Project with billing enabled. See Creating and Managing Projects for creating a new project. To make cleanup easier it's recommended to create a new project.

Run Demo in a Google Cloud Shell

Click the button below to run the demo in a [Google Cloud Shell][10].

Open in Cloud Shell

Install kubstomize in Cloud Shell by following these commands:

opsys=linux
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest |\
  grep browser_download |\
  grep $opsys |\
  cut -d '"' -f 4 |\
  xargs curl -O -L
mv kustomize_*_${opsys}_amd64 kustomize
chmod u+x kustomize
sudo mv kustomize /usr/local/bin/

Then, execute this command in order to setup gcloud cli. Please setup your region and zone.

gcloud init

Tools

  1. Terraform >= 0.12.3
  2. Google Cloud SDK version >= 253.0.0
  3. kubectl matching the latest GKE version

Supported Operating Systems

This project will run on macOS, Linux, or in a [Google Cloud Shell][10].

Required GCP APIs

The following APIs will be enabled in the project:

  • Kubernetes Engine API
  • Cloud DNS API

Install Cloud SDK

The Google Cloud SDK is used to interact with your GCP resources. Installation instructions for multiple platforms are available online.

Install kubectl CLI

The kubectl CLI is used to interact with both Kubernetes Engine and kubernetes in general. Installation instructions for multiple platforms are available online.

Install Kustomize

Kustomize is a tool for customization of kubernetes YAML files. Kustomize will take the original Kubernetes manifests YAML files and customize them while leaving the originals untouched. To install Kustomize on your OS, follow the instructions here. we will be using the manifests under demo-app/base-manifests for our applications while customizing them later using Kustomize CLI

Install Terraform

Terraform is used to automate the manipulation of cloud infrastructure. Its installation instructions are also available online.

Configure Authentication

The Terraform configuration will execute against your personal account's GCP environment to create various resources. To set up the default account, run the following command to select the appropriate one:

gcloud auth application-default login

Deployment

What are we deploying

The end goal is to deploy a GKE Ingress that uses a Google managed certificate for ssl termination. In this example, we will create:

  1. GKE cluster deployed with terraform
  2. Public static ip deployed with terraform and will be used as our Ingress IP
  3. DNS record deployed pointing our domain name to our Ingress ip. It is also deployed with terraform
  4. Google managed certificated for our domain deployed using gcloud since terraform has no support yet for this beta feature.
  5. Kubernetes application that contains a deployment, service and an Ingress which uses the certificate customized with Kustomize and deployed with kubectl

Terraform structure

There are four Terraform files provided in this example. The first one, main.tf, is the starting point for Terraform. It describes the features that will be used and the resources that will be manipulated. The second file is provider.tf, which indicates which cloud provider and version will be the target of the Terraform commands--in this case GCP. The third file, is outputs.tf and has all of the outputs that will result from deploying those resources. The final file is variables.tf, which contains a list of variables that are used as inputs into Terraform. Any variables referenced in the main.tf file that do not have defaults configured in variables.tf, will result in prompts to the user at runtime.

Kustomize explained

Kustomize lets you customize raw, template-free YAML files for multiple purposes, leaving the original YAML untouched and usable as is. The idea behind kustomize is taking a set of generic kubernetes manifests and describing how you want to customize them in a kustomization.yaml file. For our case, we used a generic application that uses Ingress from this link. You can find the YAML files for this App under demo-app/base-manifests folder. Later, we will customize them using kustomize to add some annotations to the Ingress resource.

A summary of the steps to create a customized Kubernetes manifest are listed below:

  1. Create a kustomization.yaml file using touch kustomization.yaml
  2. Declare generic resources YAML files you want to add to the file using the kustomize edit add resource command.
  3. Create a patch file describing how you want to update those resources from the original ones and add it to kustomization.yaml file with the kustomize edit add patch [filename] command.
  4. Finally, use kustomize build command to generate the final YAML manifest.

More documentation about kustomize and how you can use it can be found in their official website.

Deploying the scenario

To build out the environment, first we need to export two variables.

The first one contains the domain name we want to assign to our Ingress. The second is the DNS managed zone name which creates the DNS record for Ingress.

Open a terminal and export these variables according to your setup:

  • export DOMAIN="heyingress.fakedomain.com"
  • export MANAGED_ZONE="fakedomain-zone"

You will need to replace our fake values with your real domain. For instance if you owned google.com you could use.

  • export DOMAIN="heyingress.google.com"
  • export MANAGED_ZONE="google-zone"

But as we mentioned you need your own domain for this demo to function.

Now you can execute the following make command to run the demo:

make create

Once completed, The certificate can take up to an hour before it becomes active. you can check the status of the certificiate with gcloud:

gcloud beta compute ssl-certificates list heyingress

Once the certificate is active, you can use the describe action to see the certificate details:

gcloud compute ssl-certificates describe heyingress

The application deployed will be available on https://heyingress.fakedomain.com

Drop the URL in the browser or use curl to verify that the application is deployed.

curl https://heyingress.fakedomain.com

To view the deployed ingress and the annotations using the managed certificate, run:

kubectl describe ingress demo-ing

Validation

Validation is fully automated. In order to validate that resources are installed and Ingress is properly configured, run:

make validate

Teardown

Teardown is fully automated. The destroy script deletes all resources created using Terraform. Terraform variable configuration and state files are also cleaned if Terraform destroy is successful. To delete all created resources in GCP, run:

make teardown

Since Terraform tracks the resources it created it is able to tear them all down.

Troubleshooting

when you create a google managed certificate, it takes approximately 30 to 60 minutes before the certificate is activated for the domain. If the certificate status is not set to active or provisioning, hop on here for more information on what went wrong. Usually, it's either your dns is not properly configured or the Ingress did not create HTTP/s load balancer with the ip pointed to by the dns record you created.

Relevant Material

This is not an officially supported Google product

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].