The objective of this lab is to demonstrate the deployment of an application into a Managed Kubernetes instance running on an App Stack Customer Edge (CE). We will deploy the F5 Distributed Cloud (XC) Ingress Controller to route traffic from the internet to an application, and NGINX Ingress Controller to provide granular routing capabilities to this application.
As an ideal, application code should be versioned and maintained in a secure Source Control Management (SCM) repository, such as Git. However, what about the configuration, management and governance of infrastructure?
GitOps is an operational framework that takes DevOps best practices used for application development such as version control, collaboration, compliance, and CI/CD, and applies them to infrastructure automation.
We will be practicing GitOps for Continuous Deployment of our applications. ArgoCD is the tool we will be using to watch your lab repository for changes, and automatically deploy updated resources to Kubernetes for you.
Upon first starting the lab, an XC App Stack Managed K8s cluster has been deployed for you in an AWS VPC. An namespace for you to deploy applications into has been created, and the ArgoCD application has been installed for you.
Upon successful completion of this lab, the following components will have been deployed by you with the help of ArgoCD:
- Grafana and Prometheus for metrics collection and analytics dashboards
- XC Ingress Controller for creation of Load Balancers & Origin Pools for service connectivity
- NGINX Ingress Controller for advanced traffic routing
- A microservices application called "Brewz", complete with XC Load Balancers & Origin Pools for service connectivity
You will need a GitHub Account for this lab. If you do not have one, go set one up at GitHub, then resume this lab. Make note of your username, as you will need it later in this lab.
-
On your desktop (not the lab VM), you will need to fork the lab repository to your GitHub account. If this is your first time, you may want to review the GitHub Docs on how to Fork a repo after completing this lab.
You can complete this task through the repository GitHub UI:
Note: If you are a member of any GitHub organizations, be sure to select yourself as the owner, and not an organization (such as
f5devcentral
ornginxinc
):
-
In your browser, navigate to the Terraform Modular Demo Framework blueprint.
-
Click the Deploy button, and deploy it in the region geographically closest to you.
-
Start the UDF deployment with the default suggested resource settings.
-
If the devbox component is not running, start it now.
-
Select the XRDP access method in this component.
-
Once the RDP file downloads, open it with your Remote Desktop client of choice, usually by double-clicking on the downloaded file.
-
When prompted to login, use the credentials that are shown in the Documentation tab of the devbox UDF component.
-
Once you started the UDF deployment, a workflow was triggered to create a user account for you in the
f5-sales-demo
tenant. You should have received an email requesting you to set your password for this account. Follow those instructions in the email to set a password for your account.Note: If you already have an account in the
f5-sales-demo
XC tenant, you can simply log in with your existing credentials. -
If you are prompted for an XC domain, enter
f5-sales-demo
and click Next. -
Login using your email and the password you just set:
-
If prompted, review and accept the Terms of Service and Privacy Policy.
-
When asked to identify yourself, select all the checkboxes, and click Next.
-
Click
Advanced
and click Get Started. -
Once you are logged into the tenant, navigate to Multi-Cloud App Connect.
-
In the URL and navigation breadcrumb, you will find the namespace that has been randomly generated for you:
Note: If you already have an account in the
f5-sales-demo
XC tenant, you may have a personal application namespace. If not, create one now, and note its name. -
Make a note of the above namespace, as you will need it in an upcoming step.
-
In the lab devbox VM you are RDP connected to, open a terminal and run the following script to initiate the infrastructure build for this lab:
export TF_VAR_namespace=<your xc namespace here> cd ~/terraform-modular-demo-framework ./gitops-lab/setup-lab-environment.sh
Note: This should take between 25-30 minutes to complete.
Note: If you see PendingVerification Error, go to Pending Verification Recovery otherwise, proceed.
The script you just triggered does a number of things:
- It sets up the credentials for the UDF environment you are in to authenticate with AWS and XC
- Deploys VPCs, Subnets, NAT Gateways, etc to AWS
- Deploys the mk8s cluster object in XC
- Deploys a 1x node App Stack instance in the AWS region/VPC you deployed in
- Creates your k8s namespace, and deploys ArgoCD and the initial XC Load Balancers you will need for the lab
You must wait for the above script to complete before proceeding with the lab
-
In the devbox VM, Open Visual Studio Code: Applications -> Development -> Visual Studio Code
Note: If you see an Authentication required prompt to Unlock Login Keyring, then enter the same credentials used to RDP into the jumphost.
-
Click the Terminal -> New Terminal menu item to open a bash shell session if one is not already open at the bottom of the window.
Later in this lab, you will require GitHub authentication to push commits back to your forked repo.
-
Log into GitHub using the
gh
CLI:gh auth login -h github.com -p https -w
-
An authorization code will be shown. Copy this for use later.
-
Press Enter to open the browser.
-
Enter your GitHub username, then password.
Note: If you have Multifactor authentication set up on your GitHub account, you may be prompted to respond to a Multifactor challenge. Do this now.
-
Enter the authorization code (described 3 steps earlier) when prompted.
-
Click the Authorize github button on the next screen.
We will now clone your forked copy of the workshop repository to your lab workstation.
-
In Visual Studio Code, configure your Git name and email by entering the following into the terminal window. These will be used for Git commit logs:
git config --global user.email "<your work email address>" git config --global user.name "<your full name>"
-
Create an environment variable with your GitHub username:
Note: Make sure to replace
<your github user name>
with actual your GitHub username.export GITHUB_USER=<your github user name>
-
Clone your repository via the git command:
cd ~ git clone https://github.com/$GITHUB_USER/techxchange-gitops-lab.git
-
Click File -> Open Folder and select the
ubuntu
->techxchange-gitops-lab
folder that was just created from the command above, and click Open.
-
In Visual Studio Code, click the Terminal -> New Terminal menu item.
-
Run the following command in the terminal window to generate personalized Kubernetes manifests you will be using in this lab:
Note: Since this is a new bash session, you will once again need to specify your GitHub username. Make sure to replace
<your github user name>
with actual your GitHub username.export GITHUB_USER=<your github user name> gomplate -t gomplate-templates.tmpl
-
Using the Source Control pane, stage and commit the entire contents of the
charts
andmanifests
folders that were just created for you.Note: If Visual Studio Code does not detect the changes, you may need to click the refresh button in the source control panel:
-
Push the changes to your origin repository.
-
You may see several prompts in a row:
-
If prompted "This action will push and pull...", click the Ok button.
-
If prompted by "The extension 'GitHub' wants to sign in using GitHub", click the Allow button, then Open xdg-button button that pops up in the browser.
-
If prompted with "Allow an extension to open this URI?", click the Open button.
-
If prompted to "Unlock Login Keyring", enter the password you used to connect to this Ubuntu workstation, and click the Unlock button.
-
-
Use the terminal to open the Chrome browser to your repository and verify that your changes were successfully pushed to your GitHub repo:
google-chrome https://github.com/$GITHUB_USER/techxchange-gitops-lab.git
To test interactions with the App Stack Kubernetes cluster, you will use the kubeconfig
. A kubeconfig configuration file has already been provided for you on the devbox vm.
-
In the Visual Studio Code terminal window, use
kubectl
to test your new configuration:kubectl get nodes
You should see the Kubernetes node in an output similar to this:
NAME STATUS ROLES AGE VERSION ip-100-64-1-95.us-east-2.compute.internal Ready ves-master 12m v1.23.14-ves
Your App Stack Managed Kubernetes cluster is now ready to accept configuration.