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

Updates #409

Merged
merged 22 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0743846
ImageCleaner GA (no longer preview)
skabou Apr 1, 2024
cc5c1ee
mcr image with curl
skabou Apr 1, 2024
edebe27
mcr image with curl
skabou Apr 1, 2024
cd4a214
Merge branch 'main' of https://github.com/skabou/aks-baseline
skabou Apr 3, 2024
a836d43
Merge branch 'main' of https://github.com/skabou/aks-baseline
skabou Apr 3, 2024
dada7d3
Delete aspnetapp-ingress-patch.yaml
skabou Apr 3, 2024
7bba6a3
Merge branch 'main' of https://github.com/skabou/aks-baseline
skabou Apr 3, 2024
3567e16
Delete nested_K8sCustomIngressTlsHostsHaveDefinedDomainSuffix.bicep
skabou Apr 4, 2024
0e5f541
Merge branch 'main' of https://github.com/skabou/aks-baseline
skabou Apr 3, 2024
6dab026
restore nested_K8s...
skabou Apr 4, 2024
1e34410
Update nested_K8sCustomIngressTlsHostsHaveDefinedDomainSuffix.bicep
skabou Apr 4, 2024
4ed7a7e
Delete .gitignore
skabou Apr 4, 2024
8b017f0
restore .gitignore
skabou Apr 4, 2024
9a5e183
restore .gitignore
skabou Apr 4, 2024
7bd8110
correction
skabou Apr 4, 2024
ebc9e71
Revert "correction"
skabou Apr 4, 2024
6f1acb1
Revert "restore .gitignore"
skabou Apr 4, 2024
83aeb40
Revert "Delete .gitignore"
skabou Apr 4, 2024
62ac51c
Revert "Update nested_K8sCustomIngressTlsHostsHaveDefinedDomainSuffix…
skabou Apr 4, 2024
56e6705
Revert "restore nested_K8s..."
skabou Apr 4, 2024
6aea1a3
Revert "Merge branch 'main' of https://github.com/skabou/aks-baseline"
skabou Apr 4, 2024
24fbe48
Restore nested_K8sCustomIngressTlsHostsHaveDefinedDomainSuffix.bicep
skabou Apr 4, 2024
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
14 changes: 0 additions & 14 deletions 01-prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ This is the starting point for the instructions on deploying the [AKS baseline r

[![Launch Azure Cloud Shell](https://learn.microsoft.com/azure/includes/media/cloud-shell-try-it/launchcloudshell.png)](https://shell.azure.com)

1. While the following feature(s) are still in *preview*, enable them in your target subscription.

1. [Register the ImageCleaner (Earser) preview feature = `EnableImageCleanerPreview`](https://learn.microsoft.com/azure/aks/image-cleaner#prerequisites)

```bash
az feature register --namespace "Microsoft.ContainerService" -n "EnableImageCleanerPreview"

# Keep running until all say "Registered." (This may take up to 20 minutes.)
az feature list -o table --query "[?name=='Microsoft.ContainerService/EnableImageCleanerPreview'].{Name:name,State:properties.state}"

# When all say "Registered" then re-register the AKS resource provider
az provider register --namespace Microsoft.ContainerService
```

1. Clone/download this repo locally, or even better fork this repository.

> :twisted_rightwards_arrows: If you have forked this reference implementation repo, you'll be able to customize some of the files and commands for a more personalized and production-like experience; ensure references to this Git repository mentioned throughout the walk-through are updated to use your own fork.
Expand Down
4 changes: 2 additions & 2 deletions 07-bootstrap-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GitOps allows a team to author Kubernetes manifest files, persist them in their
- Cluster-wide configuration of Azure Monitor for Containers
- The workload's namespace named `a0008`

1. Install `kubectl` 1.27 or newer. (`kubectl` supports ±1 Kubernetes version.)
1. Install `kubectl` 1.28 or newer. (`kubectl` supports ±1 Kubernetes version.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we maintaining the client version n-1 for a reason? Any desire to move over 1.29 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the guidance I received from @ckittel on a previous PR.

Also, it appears to be official policy from Kubernetes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, while Im aware of how it gets supported, I was wondering why we are prescribing that. Just wanted to learn from this.


```bash
sudo az aks install-cli
Expand Down Expand Up @@ -86,4 +86,4 @@ It is recommended to have a clearly defined bootstrapping process that occurs as

### Next step

:arrow_forward: [Prepare for the workload by installing its prerequisites](./08-workload-prerequisites.md)
:arrow_forward: [Prepare for the workload by installing its prerequisites](./08-workload-prerequisites.md)
4 changes: 2 additions & 2 deletions 09-secret-management-and-ingress-controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Previously you have configured [workload prerequisites](./08-workload-prerequisi

```bash
# Import ingress controller image hosted in public container registries
az acr import --source docker.io/library/traefik:v2.10.7 -n $ACR_NAME_AKS_BASELINE
az acr import --source docker.io/library/traefik:v2.11 -n $ACR_NAME_AKS_BASELINE
```

1. Install the Traefik Ingress Controller.
Expand All @@ -83,4 +83,4 @@ Previously you have configured [workload prerequisites](./08-workload-prerequisi

### Next step

:arrow_forward: [Deploy the Workload](./10-workload.md)
:arrow_forward: [Deploy the Workload](./10-workload.md)
2 changes: 1 addition & 1 deletion 10-workload.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The cluster now has an [Traefik configured with a TLS certificate](./09-secret-m
> You should expect a `403` HTTP response from your ingress controller if you attempt to connect to it *without* going through the App Gateway. Likewise, if any workload other than the ingress controller attempts to reach the workload, the traffic will be denied via network policies.

```bash
kubectl run curl -n a0008 -i --tty --rm --image=mcr.microsoft.com/azure-cli --overrides='[{"op":"add","path":"/spec/containers/0/resources","value":{"limits":{"cpu":"200m","memory":"128Mi"}}},{"op":"add","path":"/spec/containers/0/securityContext","value":{"readOnlyRootFilesystem": true}}]' --override-type json --env="DOMAIN_NAME=${DOMAIN_NAME_AKS_BASELINE}"
kubectl run curl -n a0008 -i --tty --rm --image=mcr.microsoft.com/devcontainers/base --overrides='[{"op":"add","path":"/spec/containers/0/resources","value":{"limits":{"cpu":"200m","memory":"128Mi"}}},{"op":"add","path":"/spec/containers/0/securityContext","value":{"readOnlyRootFilesystem": true}}]' --override-type json --env="DOMAIN_NAME=${DOMAIN_NAME_AKS_BASELINE}"
ferantivero marked this conversation as resolved.
Show resolved Hide resolved

# From within the open shell now running on a container inside your cluster
curl -kI https://bu0001a0008-00.aks-ingress.$DOMAIN_NAME -w '%{remote_ip}\n'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Finally, this implementation uses the [ASP.NET Core Docker sample web app](https

#### Azure platform

- AKS v1.28
- AKS v1.29
- System and User [node pool separation](https://learn.microsoft.com/azure/aks/use-system-pools)
- [AKS-managed Microsoft Entra ID integration](https://learn.microsoft.com/azure/aks/managed-aad)
- Microsoft Entra ID-backed Kubernetes RBAC (*local user accounts disabled*)
Expand All @@ -43,7 +43,7 @@ Finally, this implementation uses the [ASP.NET Core Docker sample web app](https
- [ImageCleaner (Eraser)](https://learn.microsoft.com/azure/aks/image-cleaner) *[AKS-managed add-on]*
- [Kubernetes Reboot Daemon](https://learn.microsoft.com/azure/aks/node-updates-kured)
- [Secrets Store CSI Driver for Kubernetes](https://learn.microsoft.com/azure/aks/csi-secrets-store-driver) *[AKS-managed add-on]*
- [Traefik Ingress Controller](https://doc.traefik.io/traefik/v2.10/routing/providers/kubernetes-ingress/)
- [Traefik Ingress Controller](https://doc.traefik.io/traefik/v2.11/routing/providers/kubernetes-ingress/)

![Network diagram depicting a hub-spoke network with two peered VNets and main Azure resources used in the architecture.](https://learn.microsoft.com/azure/architecture/reference-architectures/containers/aks/images/secure-baseline-architecture.svg)

Expand Down Expand Up @@ -152,4 +152,4 @@ Please see our [Contributor guide](./CONTRIBUTING.md).

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact <[email protected]> with any additional questions or comments.

With :heart: from Microsoft Patterns & Practices, [Azure Architecture Center](https://aka.ms/architecture).
With :heart: from Microsoft Patterns & Practices, [Azure Architecture Center](https://aka.ms/architecture).
8 changes: 4 additions & 4 deletions cluster-stamp.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ param clusterAuthorizedIPRanges array = []
@description('AKS Service, Node Pool, and supporting services (KeyVault, App Gateway, etc) region. This needs to be the same region as the vnet provided in these parameters. This defaults to the resource group\'s location for higher reliability.')
param location string = resourceGroup().location

param kubernetesVersion string = '1.28.3'
param kubernetesVersion string = '1.29'

@description('Domain name to use for App Gateway and AKS ingress.')
param domainName string = 'contoso.com'
Expand Down Expand Up @@ -1632,7 +1632,7 @@ resource mc 'Microsoft.ContainerService/managedClusters@2024-01-02-preview' = {
osDiskSizeGB: 80
osDiskType: 'Ephemeral'
osType: 'Linux'
osSKU: 'Ubuntu'
osSKU: 'AzureLinux'
minCount: 3
maxCount: 4
vnetSubnetID: targetVirtualNetwork::snetClusterNodes.id
Expand Down Expand Up @@ -1666,7 +1666,7 @@ resource mc 'Microsoft.ContainerService/managedClusters@2024-01-02-preview' = {
osDiskSizeGB: 120
osDiskType: 'Ephemeral'
osType: 'Linux'
osSKU: 'Ubuntu'
osSKU: 'AzureLinux'
minCount: 2
maxCount: 5
vnetSubnetID: targetVirtualNetwork::snetClusterNodes.id
Expand Down Expand Up @@ -2321,4 +2321,4 @@ resource agwdiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01

output aksClusterName string = clusterName
output aksIngressControllerPodManagedIdentityClientId string = podmiIngressController.properties.clientId
output keyVaultName string = kv.name
output keyVaultName string = kv.name
53 changes: 1 addition & 52 deletions nested_K8sCustomIngressTlsHostsHaveDefinedDomainSuffix.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -84,57 +84,6 @@ resource pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix 'Microsoft.Authorizat
}
defaultValue: {
}
schema: {
skabou marked this conversation as resolved.
Show resolved Hide resolved
description: 'A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all resources.'
type: 'object'
properties: {
matchLabels: {
description: 'matchLabels is a map of {key,value} pairs.'
type: 'object'
additionalProperties: {
type: 'string'
}
minProperties: 1
}
matchExpressions: {
description: 'matchExpressions is a list of values, a key, and an operator.'
type: 'array'
items: {
type: 'object'
properties: {
key: {
description: 'key is the label key that the selector applies to.'
type: 'string'
}
operator: {
description: 'operator represents a key\'s relationship to a set of values.'
type: 'string'
enum: [
'In'
'NotIn'
'Exists'
'DoesNotExist'
]
}
values: {
description: 'values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.'
type: 'array'
items: {
type: 'string'
}
}
}
required: [
'key'
'operator'
]
additionalProperties: false
}
minItems: 1
}
}
additionalProperties: false
}
}
allowedDomainSuffixes: {
type: 'Array'
Expand All @@ -150,4 +99,4 @@ resource pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix 'Microsoft.Authorizat

output policyId string = pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix.id
output policyName string = pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix.properties.displayName
output policyDescription string = pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix.properties.description
output policyDescription string = pdK8sCustomIngressTlsHostsHaveDefinedDomainSuffix.properties.description
2 changes: 1 addition & 1 deletion workload/aspnetapp-ingress-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
value: bu0001a0008-00.aks-ingress.contoso.com
- op: replace
path: "/spec/rules/0/host"
value: bu0001a0008-00.aks-ingress.contoso.com
skabou marked this conversation as resolved.
Show resolved Hide resolved
value: bu0001a0008-00.aks-ingress.contoso.com
2 changes: 1 addition & 1 deletion workload/aspnetapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ spec:
name: aspnetapp-service
port:
number: 80
---
---
4 changes: 2 additions & 2 deletions workload/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ kind: Kustomization
resources:
- aspnetapp.yaml

patchesJson6902:
patches:
- target:
kind: Ingress
name: aspnetapp-ingress
version: v1
path: aspnetapp-ingress-patch.yaml
path: aspnetapp-ingress-patch.yaml
8 changes: 4 additions & 4 deletions workload/traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app.kubernetes.io/name: traefik-ingress-ilb
app.kubernetes.io/instance: traefik-ingress-ilb
---
#https://raw.githubusercontent.com/traefik/traefik/v2.10/docs/content/reference/dynamic-configuration/kubernetes-crd-rbac.yml
#https://raw.githubusercontent.com/traefik/traefik/v2.11/docs/content/reference/dynamic-configuration/kubernetes-crd-rbac.yml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand Down Expand Up @@ -230,10 +230,10 @@ spec:
# PRODUCTION READINESS CHANGE REQUIRED
# This image should be sourced from a non-public container registry, such as the
# one deployed along side of this reference implementation.
# az acr import --source docker.io/library/traefik:v2.10.7 -n <your-acr-instance-name>
# az acr import --source docker.io/library/traefik:v2.11 -n <your-acr-instance-name>
# and then set this to
# image: <your-acr-instance-name>.azurecr.io/library/traefik:v2.10.7
- image: docker.io/library/traefik:v2.10.7
# image: <your-acr-instance-name>.azurecr.io/library/traefik:v2.11
- image: docker.io/library/traefik:v2.11
imagePullPolicy: IfNotPresent
name: traefik-ingress-controller
resources:
Expand Down