Skip to content

Latest commit

 

History

History
257 lines (146 loc) · 11.5 KB

introduction.md

File metadata and controls

257 lines (146 loc) · 11.5 KB

Lab Introduction

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

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.

Lab Architecture

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

Lab architecture

Getting Started

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.

Fork the lab repository

  1. 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:

    GitHub Fork

    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 or nginxinc):

    GitHub Fork

Deploy the TechXchange GitOps UDF Blueprint

  1. In your browser, navigate to the Terraform Modular Demo Framework blueprint.

  2. Click the Deploy button, and deploy it in the region geographically closest to you.

    UDF Deploy UDF Deploy 2
  3. Start the UDF deployment with the default suggested resource settings.

    UDF Resources UDF Resources 2

Log into the devbox VM in the UDF Deployment

  1. If the devbox component is not running, start it now.

  2. Select the XRDP access method in this component.

    UDF Component UDF XRDP Access Method
  3. Once the RDP file downloads, open it with your Remote Desktop client of choice, usually by double-clicking on the downloaded file.

  4. When prompted to login, use the credentials that are shown in the Documentation tab of the devbox UDF component.

Log into F5 Distributed Cloud Console

  1. 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.

  2. If you are prompted for an XC domain, enter f5-sales-demo and click Next.

    XC Domain
  3. Login using your email and the password you just set:

    XC Login
  4. If prompted, review and accept the Terms of Service and Privacy Policy.

  5. When asked to identify yourself, select all the checkboxes, and click Next.

  6. Click Advanced and click Get Started.

  7. Once you are logged into the tenant, navigate to Multi-Cloud App Connect.

  8. In the URL and navigation breadcrumb, you will find the namespace that has been randomly generated for you:

    XC Namespace

    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.

  9. Make a note of the above namespace, as you will need it in an upcoming step.

Trigger build of lab environment

  1. 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

  1. You should see an output similar to this when the script has completed successfully:

    Setup Complete


Stop

You must wait for the above script to complete before proceeding with the lab



Configure Git in Visual Studio Code

  1. 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.

  2. 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.

Configure GitHub authentication

Later in this lab, you will require GitHub authentication to push commits back to your forked repo.

  1. Log into GitHub using the gh CLI:

    gh auth login -h github.com -p https -w
  2. An authorization code will be shown. Copy this for use later.

  3. Press Enter to open the browser.

  4. 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.

  5. Enter the authorization code (described 3 steps earlier) when prompted.

  6. Click the Authorize github button on the next screen.

Clone your workshop repository

We will now clone your forked copy of the workshop repository to your lab workstation.

  1. 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>"
  2. 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>
  3. Clone your repository via the git command:

    cd ~
    git clone https://github.com/$GITHUB_USER/techxchange-gitops-lab.git
  4. Click File -> Open Folder and select the ubuntu -> techxchange-gitops-lab folder that was just created from the command above, and click Open.

Set up your lab environment

  1. In Visual Studio Code, click the Terminal -> New Terminal menu item.

  2. 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
  3. Using the Source Control pane, stage and commit the entire contents of the charts and manifests folders that were just created for you.

    Visual Studio Source Control commit

    Note: If Visual Studio Code does not detect the changes, you may need to click the refresh button in the source control panel:

    Visual Studio Source Control refresh
  4. Push the changes to your origin repository.

    Visual Studio Source Control sync
  5. 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.

  6. 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

Test App Stack Managed Kubernetes with Kubeconfig

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.

  1. 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.

Continue to next section...