This repository is a full example of a CI/CD pipeline using GitHub actions, terraform and other tech to create and deploy workloads to a GKE Autopilot installation.
It includes working examples of:
Code management (GitHub)
Google Cloud
Infrastructure as Code
Platform Tooling
We will be deploying a container image of a customized 'ffmpeg' build to a GKE Autopilot Kubernetes cluster.
Note: Due to the need for potentially 15k+ nodes, configuration and deployment of multiple Autopilot clusters must be supported.
With respect to using ffmpeg for transcoding, we have done some research and documented the following areas of concern:
These instructions walk you through setting up your environment for this project.
You will need to clone this repository to the machine you want to use to set up your Google Cloud environment.
Note: We recommended using Google Cloud Shell instead of your local laptop. Cloud Shell has all the tooling you need already pre-installed.
First authenticate to Google Cloud:
gcloud auth application-default login
Create a new project (skip this if you already have a project created):
gcloud projects create <your-project-id>
Set the new project as your context for the gcloud
CLI:
gcloud config set project <your-project-id>
Check if your authentication is ok and your project id is set:
gcloud projects describe <your-project-id>
Note: You should see your
projectId
listed with anACTIVE
state.
Setup your unique .env
variables to be used throughout the setup
process
bash ./scripts/setup-env.sh
NOTE: During this step you will be prompted for a couple inputs relative to your unique project. Most inputs will contain defaults that might already be set, in which case go ahead and press [ENTER] to accept and continue.
- The GitHub username/organization. This is the value used above when you cloned your fork.
- The name of the GitHub repository, by default this is set to
gke-github-deployment
.- Your unique Google Cloud project ID.
- Defaut region location for Google Cloud setup.
- A short (3-5 char) identifier for your cloud resources (e.g. gcp).
Finally, enable all the needed Google Cloud APIs by running this script:
bash ./scripts/enable-api.sh
Instructions for setting up and using GitHub Actions can be found here.
There are 2 options for deployment:
Run the terraform
CLI on the command line directly. See instructions here.
Use a GitHub Action to run all the Terraform configuration files. See instructions here.
Instructions for setting up GKE can be found here
Instructions for building container images can be found here.
Kueue is a Kubernetes-native system that manages job quotas by determining when jobs should wait, start, or be preempted.
Instructions for running some Kueue examples can be found here.
Workflows is a fully managed orchestration platform that executes services in an order that you define.
Instructions for setting up Workflows and running transcoding jobs through it can be found here.
Instructions for setting up BQ resources can be found here
For one-time or routine batch processing, the Compute Engine Batch service can be used to define a job template, setup quota, schedule 1-N jobs, clean up, and monitor/troubleshoot jobs as they run.
Instructions for setting up Batch Compute Jobs in your environment can be found here.