Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,33 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

- [Code of Conduct](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [Issues and Bugs](#issue-and-bugs)
- [Feature Requests](#feature-requests)
- [Submission Guidelines](#submission-guidelines)

## Code of Conduct

Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Visit our [Code of Conduct](CODE_OF_CONDUCT.md) doc as well.

## Found an Issue
## Issue and Bugs

If you find a bug in the source code or a mistake in the documentation, you can help us by
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.
[submitting an issue](#submitting-an-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submitting-a-pull-request-pr) with a fix.

## Feature Requests

## Want a Feature
You can *request* a new feature by [submitting an issue](#submitting-an-issue) to the GitHub
Repository.

You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
Repository. If you would like to *implement* a new feature, please submit an issue with
- **Bigger Features** - If you would like to *implement* a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.

- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submitting-a-pull-request-pr).

## Submission Guidelines

Expand Down Expand Up @@ -63,12 +68,10 @@ Before you submit your Pull Request (PR) consider the following guidelines:

- Search the repository `https://github.com/[organization-name]/[repository-name]/pulls` for an open or closed PR
that relates to your submission. You don't want to duplicate effort.

- Make your changes in a new git fork:

- Commit your changes using a descriptive commit message
- Push your fork to GitHub:
- In GitHub, create a pull request
- Make your changes in a new git fork.
- Commit your changes using a descriptive commit message.
- Push your fork to GitHub.
- In GitHub, create a pull request against `main` from your fork.
- If we suggest changes then:
- Make the required updates.
- Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
Expand Down
218 changes: 126 additions & 92 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions labs/advanced-labs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Advanced Lab Table of Contents

- [AKS-IoT](./aks-iot/README.md)
- [Canary Releases](./canary/README.md)
- [Monitoring](./monitoring/README.md)
- [Fluent Bit](./monitoring/fluent-bit/README.md)
- [Prometheus](./monitoring/prometheus/README.md)
- [More Complex App Example: Vision on Edge (VoE)](./voe/README.md)
215 changes: 104 additions & 111 deletions labs/advanced-labs/aks-iot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,113 +2,118 @@

## AKS-IoT is in Preview

- AKS-IoT is in preview so there's a chance these instructions will change over time
- Reach out to the soldevx team for access to AKS-IoT preview
> **NOTE**: AKS-IoT is in preview so there's a chance these instructions will
change over time!

## This document is a work in progress
Reach out to the [soldevx](mailto:soldevx@microsoft.com) team for access to AKS-IoT preview.
TODO: Is this how they would want to be contacted?

## PLEASE NOTE: This document is a work in progress

The current instructions are run in PowerShell.

## AKS-IoT Setup

- Create a new Azure VM with Windows 10
- You can also use your Windows 10 or Windows 11 computer
- You can also use your local Windows 10 or Windows 11 computer
- Run Windows Update
- Install Hyper-V
- Requires reboot
- Install git CLI
- Install gh CLI
- Install az CLI
- Install VS Code
- Install Hyper-V - **NOTE**: This requires a reboot!
- Install, if not already on your machine:
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [Github CLI](https://cli.github.com/manual/installation)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
- [VS Code](https://code.visualstudio.com/Download)

- Install Chocolatey
- `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))`

- Install Helm
- `choco install kubernetes-helm`

## Update bootstrap/aksiot-userconfig.json

- Azure
- ResourceGroupName
- ClusterName
## Update `bootstrap/aksiot-userconfig.json`

## Set permanent Env Vars
TODO: Does this file exist yet? or is it created in a different process?

- Update with your values
From the Azure portal, add these values to the file:

```powershell
- ResourceGroupName
- ClusterName

setx AZ_TENANT yourTenant
setx AZ_SP_ID yourServicePrincipal
setx AZ_SP_KEY yourSPKey
setx PAT yourPAT
setx PIB_PAT %PAT%
setx GITHUB_TOKEN %PAT%
## Set permanent Env Vars

setx PIB_CLUSTER your-cluster-name-101
setx PIB_RESOURCE_GROUP yourRG
setx PIB_FULL_REPO https://github.com/yourOrg/yourRepo
setx PIB_BRANCH yourBranch
Update with your environment to include your values:

```
```powershell
setx AZ_TENANT yourTenant
setx AZ_SP_ID yourServicePrincipal
setx AZ_SP_KEY yourSPKey
setx PAT yourPAT
setx PIB_PAT %PAT%
setx GITHUB_TOKEN %PAT%

setx PIB_CLUSTER your-cluster-name-101
setx PIB_RESOURCE_GROUP yourRG
setx PIB_FULL_REPO https://github.com/yourOrg/yourRepo
setx PIB_BRANCH yourBranch
```

- You will need to exit and start a new shell after running the setx commands
> **NOTE**: You will need to exit and start a new shell after running the `setx` commands.

## Install AKS-IoT

- todo - update with download instructions

```powershell
- TODO: update with download instructions

# when prompted for git credentials, use your PAT to avoid 2FA setup / issues
```powershell
# when prompted for git credentials, use your PAT to avoid 2FA setup / issues

# start in the directory you copied the file share to
git clone https://github.com/kubernetes101/pib-dev
# start in the directory you copied the file share to
git clone https://github.com/kubernetes101/pib-dev

# install the msi
cd bin
AksIot-K3s.msi
cd ..
# install the msi
cd bin
AksIot-K3s.msi
cd ..

```
```

- Set PiB Base to current directory

```powershell
```powershell

cd pilot-in-a-box
cd pilot-in-a-box

cd
cd

setx PIB_BASE <value from cd without CRLF>
setx PIB_BASE <value from cd without CRLF>

```
```

- From AKS-IoT/bootstrap directory
- These commands must be run from the AKS-IoT Powershell
- These commands must be run from the AKS-IoT Powershell

```powershell
```powershell

# start elevated shell
# (optional) create a shortcut on your desktop
LaunchPrompt.cmd
# start elevated shell
# (optional) create a shortcut on your desktop
LaunchPrompt.cmd

# add az cli extensions
az extension add --upgrade --name connectedk8s
az extension add --upgrade --name k8s-configuration
az extension add --upgrade --name k8s-extension
az extension add --upgrade --name k8s-configuration
# add az cli extensions
az extension add --upgrade --name connectedk8s
az extension add --upgrade --name k8s-configuration
az extension add --upgrade --name k8s-extension
az extension add --upgrade --name k8s-configuration

az provider register --namespace Microsoft.Kubernetes
az provider register --namespace Microsoft.KubernetesConfiguration
az provider register --namespace Microsoft.ExtendedLocation
az provider register --namespace Microsoft.Kubernetes
az provider register --namespace Microsoft.KubernetesConfiguration
az provider register --namespace Microsoft.ExtendedLocation

# Initialize Arc
Initialize-ArcIot
# Initialize Arc
Initialize-ArcIot

# update help (this is required later in the process)
update-help
# update help (this is required later in the process)
update-help

```
```

## Create a K3s Cluster

Expand Down Expand Up @@ -138,76 +143,64 @@ del token.txt

## Arc Enable the Cluster

> Make sure you set your Env Vars above and started a new shell
> **NOTE**: Make sure you set your Env Vars above and have started a new shell.

```powershell

# (optional) login to Azure with SP
az login --service-principal --tenant $Env:AZ_TENANT --username $Env:AZ_SP_ID --password $Env:AZ_SP_KEY

# connect the cluster to Arc
az connectedk8s connect --name $Env:PIB_CLUSTER --resource-group $Env:PIB_RESOURCE_GROUP

```

## Arc Enabled GitOps

- Create GitOps config
- Copy `pilot-in-a-box/labs/advanced-labs/aks-iot/sample-cluster.txt`
- To `pilot-in-a-box/clusters/your-cluster.yaml`
- Git add, commit, push
- Wait for ci-cd to complete

- Arc enable GitOps

```powershell

az k8s-configuration flux create `
--cluster-type connectedClusters `
--interval 1m `
--kind git `
--name gitops `
--namespace flux-system `
--scope cluster `
--timeout 3m `
--https-user gitops `
--cluster-name $Env:PIB_CLUSTER `
--resource-group $Env:PIB_RESOURCE_GROUP `
--url $Env:PIB_FULL_REPO `
--branch $Env:PIB_BRANCH `
--https-key $Env:PIB_PAT `
--kustomization `
name=flux-system `
path=./clusters/$Env:PIB_CLUSTER/flux-system/listeners `
timeout=3m `
sync_interval=1m `
retry_interval=1m `
prune=true `
force=true

```
Create GitOps config based on the following: `pilot-in-a-box/labs/advanced-labs/aks-iot/sample-cluster.txt`
will become `pilot-in-a-box/clusters/your-cluster.yaml`. Then git add, commit, push. Once the
`ci-cd` Github action is complete, you can enable Arc.

```powershell

az k8s-configuration flux create `
--cluster-type connectedClusters `
--interval 1m `
--kind git `
--name gitops `
--namespace flux-system `
--scope cluster `
--timeout 3m `
--https-user gitops `
--cluster-name $Env:PIB_CLUSTER `
--resource-group $Env:PIB_RESOURCE_GROUP `
--url $Env:PIB_FULL_REPO `
--branch $Env:PIB_BRANCH `
--https-key $Env:PIB_PAT `
--kustomization `
name=flux-system `
path=./clusters/$Env:PIB_CLUSTER/flux-system/listeners `
timeout=3m `
sync_interval=1m `
retry_interval=1m `
prune=true `
force=true

```

## Test Arc and Arc GitOps

- Open the Azure Portal
- Open Arc Blade
- Select your Cluster
- Get your Service Token
- From `AKS-IoT\bootstrap` directory
- `type servicetoken.txt`
- Copy and paste token
Open the Azure Portal and open the Arc Blade. Locate your cluster and get a Service Token.
TODO: Is this accurate?--> From `AKS-IoT\bootstrap` directory, copy the Service Token into a file
`servicetoken.txt`.

## Delete Cluster

- From the aks-iot/bootstrap dir
From within the the `aks-iot/bootstrap` directory:

```powershell

LaunchPrompt.cmd

# delete the cluster
Remove-AksIotNode

exit

```
Loading