Git Product home page Git Product logo

pib-dev's Introduction

Pilot-in-a-Box Overview

Introduction

Kubernetes is hard. Getting started and set up for the first time can take weeks to get right. Managing deployments on a fleet of Kubernetes clusters on the edge brings even more challenges.

Pilot-in-a-Box (PiB) is a game-changer for the end-to-end Kubernetes app development cycle from a local cluster to deployments on the edge. It reduces the initial friction and empowers the developer to get started and deployed to a dev/test environment within minutes. The pre-configured Codespaces environment includes a Kubernetes cluster and custom CLI's (kic and flt) that help streamline the initial learning curve to Kubernetes development commands.

This repo walks through the rich end-to-end developer experience in a series of labs. The labs start by walking you through creating, building, testing, and deploying an application on a local cluster (inner-loop) with a complete CNCF observability stack. Then, the labs move on to the next step of deploying the application to a test cluster in the Cloud (outer-loop). There are also several advanced labs that cover centralized monitoring, canary deployments, and targeting different devices.

PiB is not intended for production deployments. However, some concepts covered (GitOps and Observability) are production-ready

Prerequisites

  • GitHub Codespaces access
  • An Azure subscription with owner access

Notes

  • The base Codespaces images recently updated to dotnet core 7
  • PiB currently uses dotnet core 6
  • Both dotnet core 6 and 7 are installed in the Codespaces image as we migrate to dotnet 7

GitHub Codespaces

Codespaces allows you to develop in a secure, configurable, and dedicated development environment in the cloud that works how and where you want it to

  • GitHub Codespaces Overview
    • GitHub Codespaces is available for organizations using GitHub Team or GitHub Enterprise Cloud. GitHub Codespaces is also available as a limited beta release for individual users on GitHub Pro plans.
    • For more information, see "GitHub's products"

We use GitHub Codespaces for our inner-loop and outer-loop Developer Experiences. While other DevX are available, currently, we only support GitHub Codespaces.

The easiest way to get GitHub Codespaces access is to setup a GitHub Team

GitHub Codespaces is also available in beta on a limited basis for GitHub Pro users. The waiting list is normally > 3 months.

Best Practice: as you begin projects, ensure that you have Codespaces and Azure subscriptions with proper permissions

inner-loop

  • inner-loop refers to the tasks that developers do every day as part of their development process
    • Generally, inner-loop happens on the individual developer workstation
      • For PiB, the inner-loop and developer workstation is Codespaces
      • When a developer creates a Codespace, that is their "personal development workstation in the cloud"
  • As part of PiB, we have automated the creation of the developer workstation using a repeatable, consistent, Infrastructure as Code approach
    • We have an advanced workshop planned for customizing the Codespaces experience for your project
  • With the power of Codespaces, a developer can create a consistent workstation with a few clicks in less than a minute

outer-loop

  • outer-loop refers to the tasks that developers and DevOps do as they move from dev to test to pre-prod to production
    • Generally outer-loop happens on shared compute outside of the developer workstation
    • For PiB, outer-loop uses a combination of Codespaces and dev/test clusters in Azure
  • As part of PiB, we have automated the creation of dev/test clusters using a repeatable, consistent, Infrastructure as Code approach

Create a Codespace

You can use the same Codespace for any of the labs

  • From this repo
    • Click the <> Code button
      • Make sure the Codespaces tab is active
    • Click Create Codespace on main
  • After about 1 minute, you will have a GitHub Codespace running with a complete Kubernetes Developer Experience!

Environment variables

Many of these tutorials make use of environment variables, using the export functionality. If you wish, you can also edit the Z shell preferences file to persist exported environment variables across terminal sessions. Just add the same "export FOO=BAR" lines to your .zshrc file.

code ~/.zshrc

Create a working branch

  • Because the main branch has a branch protection rule, you need to create a working branch

    • You can use the same branch for any of the labs or create a new branch per lab (add 1, 2, 3 ... to the branch name)

    ๐Ÿ›‘ Many commands will fail in following labs if MY_BRANCH is not set or branch is not pushed upstream

    # by default, MY_BRANCH is set to your lower case GitHub User Name
    # the value can be overwritten if needed
    echo $MY_BRANCH
    
    # create a branch
    git checkout -b $MY_BRANCH
    
    # push the branch and set the remote
    git push -u origin $MY_BRANCH
    
  • Your prompt should end like this

    • /workspaces/Pilot-in-a-Box (mybranch) $

inner-loop Labs

  • Lab 1: Create, build, deploy, and test a new dotnet application and observability stack on your local cluster
  • Lab 2: Configure flux to automate the deployment process from Lab 1

outer-loop Labs

  • Lab 1: Create a dev/test cluster and manage application deployments on the cluster

  • Lab 2: Manage application deployments on a fleet of multiple clusters

  • Lab 3: Configure ring based deployments

  • Lab 4: Set up Azure subscription and Codespaces for advanced configuration

    • This is a prerequisite for the Advanced Labs

Advanced Labs

Cleanup

  • Once you are finished experimenting, please delete your branch

    # change to the root of the repo
    cd $PIB_BASE
    
    git pull
    git add .
    git commit -am "deleting branch"
    git push
    
    # checkout main branch, delete remote, delete local
    git checkout main
    git push origin $MY_BRANCH --delete
    git branch -D $MY_BRANCH
    

Support

This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new issue.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

pib-dev's People

Contributors

aflinchb avatar bartr avatar kev-ms avatar lyledodgegh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pib-dev's Issues

PiB env vars

I was trying out the lab: inner-loop-flux and Iwas running into an error on the command: flux create secret git flux-system -n flux-system --url "$PIB_FULL_REPO"

  • The reason for this error is that the CLIs dynamically set some environment variables
  • the solution is to run kic env and source those env variables into the shell

cc: @aflinchb @supadrasta

outer-loop.md variable not set

Description

I was going through the outer-loop.md exercise and hit a failure here...

@Larouex โžœ /workspaces/pib-dev (larouex) $ export MY_CLUSTER=central-tx-atx-$MY_BRANCH
@Larouex โžœ /workspaces/pib-dev (larouex) $ flt create cluster -c $MY_CLUSTER
Validating command
Creating Azure Resource Group
Location    Name
----------  ---------------
westus3     central-tx-atx-
Creating Azure VM: central-tx-atx-
ERROR: {"error":{"code":"InvalidTemplateDeployment","message":"The template deployment 'vm_deploy_brRwp74E6rQAdtRVxZcljhOCMZJ3FSGL' is not valid according to the validation procedure. The tracking id is '5a87b6fa-9da7-430c-b6b0-d6a5cce5ae84'. See inner errors for details.","details":[{"code":"InvalidResourceName","message":"Resource name ipconfigcentral-tx-atx- is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with '_'. The name may contain word characters or '.', '-', '_'.","details":[]}]}}
VM Creation Failed: central-tx-atx-
deleting Resource Group: central-tx-atx-

I had come back into my session and this was missing...

echo $MY_BRANCH

The overall README.MD has this step...

use lower case GitHub User Name as branch name

export MY_BRANCH=$(echo $GITHUB_USER | tr '[:upper:]' '[:lower:]')
echo $MY_BRANCH

Once I reran then all completed as expected.

Expected Behavior

MY_BRANCH is populated before doing the outer-loop,md lab

add instructions for branch

  • add instructions for creating and pushing your branch
  • many commands will fail if you're on the main branch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.