Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dispatch workflow and manifest to deploy application load balancer service #3

Merged
merged 2 commits into from
Mar 15, 2023

Conversation

chrisd8088
Copy link
Owner

As the Kubernetes load balancer service for the mongo-express application does not require redeployment on every application change, add a dispatch workflow to perform the deployment of the load balancer service only when triggered by an administrative dispatch event.

This GitHub Actions workflow expects an Azure Kubernetes Service cluster to exist and for its name and resource group to be configured as GitHub Actions secrets, as well as the Azure login credentials.

This manifest defines a Kubernetes load balancer service across all application pods with the role label of frontend. The balancer will listen on port 80 and forward requests to the pods on port 8081. Pods are selected if they also have the role label of frontend as well.

After deployment of the persistent volumes manifest, the workflow uses kubectl to wait for the service's ingress IP to be assigned. Unfortunately this can not be done exclusively with the kubectl wait command as its JSON condition matching requires a fixed string, and the IP address cannot be known in advance. Instead, use kubectl get in a loop and wait for the load balancer's status to contain an ingress key, as suggested in this comment. See also this concern regarding how JSON condition matching was implemented for kubectl wait.

This manifest defines a Kubernetes load balancer service across all
application pods with the "role" label of "frontend".  The balancer
will listen on port 80 and forward requests to the pods on port 8081.
Pods are selected if they also have the "role" label of "frontend" as well.
As the Kubernetes load balancer service for the mongo-express application
does not require redeployment on every application change, add a dispatch
workflow to perform the deployment of the load balancer service only
when triggered by an administrative dispatch event.

This GitHub Actions workflow expects an Azure Kubernetes Service cluster
to exist and for its name and resource group to be configured as
GitHub Actions secrets, as well as the Azure login credentials.

After deployment of the persistent volumes manifest, the workflow
uses kubectl to wait for the service's ingress IP to be assigned.
Unfortunately this can not be done exclusively with the "kubectl wait"
command as its JSON condition matching requires a fixed string, and
the IP address cannot be known in advance.  Instead, use "kubectl get"
in a loop and wait for the load balancer's status to contain an
"ingress" key, as suggested in:

kubernetes/kubernetes#80828 (comment)

See also this concern regarding how JSON condition matching was
implemented for "kubectl wait":

kubernetes/kubernetes#83094 (comment)
@chrisd8088 chrisd8088 merged commit eae3172 into demo Mar 15, 2023
@chrisd8088 chrisd8088 deleted the demo-add-app-service branch March 15, 2023 06:38
chrisd8088 added a commit that referenced this pull request Mar 15, 2023
PR #3 added a GitHub Actions workflow to deploy a Kubernetes load
balancer service for the application; however, inconsistent casing
was used for an action name, so that is adjusted now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant