Not much to see here, this will probably be a mess while I try and figure it all out.
An example workflow that uses GitHub Actions to deploy a static website to an existing Google Kubernetes Engine cluster.
For pushes to the default branch, master, the workflow will:
-
Verify the Google Cloud Platform credentials are correct.
-
Build, tag, and push the image to Google Container Registry.
-
gcloudserves as a credential helper for Docker. This workflow registersgcloudas a credential helper and uses the 'docker' command within thegcloudaction to push the image. -
The image is available through the following tags:
latest, the branch name, and first 8 of the commit SHA.
-
-
Use a Kubernetes Deployment to push the image to the cluster.
- Note that a GKE deployment requires a unique Tag to update the pods. Using
a constant tag
latestor a branch namemastermay result in successful workflows that don't update the cluster.
- Note that a GKE deployment requires a unique Tag to update the pods. Using
a constant tag
-
Create or reuse a Github repository for the example workflow:
-
Move into your repository directory.
-
Copy the example into the repository:
cp -r <path_to>/github-actions/example-workflows/gke/ ./
-
Add your Project Id to the repository's secret, named
GKE_PROJECT. -
Create a GKE cluster or select an existing GKE cluster.
-
Update
gke.ymlwith the following values:
-
GKE_CLUSTER: the name of your cluster. -
GKE_ZONE: the zone your cluster resides. -
IMAGE: your preferred Docker image name.
You can find the names of your clusters using the command: gcloud container clusters list,
and the zone using the command: gcloud container clusters describe <CLUSTER_NAME>.
Kubernetes Engine DeveloperStorage Admin
- Add and commit your changes:
git add .
git commit -m "Set up Github workflow"
- Push to the
masterbranch:
git push origin master
- View the workflow by selecting the
Actionstab at the top of your repository. Then click on theBuild and Deploy to GKEworkflow to see the details.