### Executing Setup Script and Sourcing Environment - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/security.md This snippet prepares the environment by entering a Devbox shell, making the `manuscript/setup/security.sh` script executable, running the script, and sourcing the `.env` file to load environment variables. Users unfamiliar with Devbox can skip this and install the necessary tools manually. ```bash devbox shell chmod +x manuscript/setup/security.sh ./manuscript/setup/security.sh source .env ``` -------------------------------- ### Prepare and Execute CDK8s Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/define-deploy-dev/cdk8s.md This snippet makes the cdk8s setup script executable and then runs it. This script likely handles initial setup steps for the cdk8s project, such as installing dependencies or setting up the project structure. ```Bash chmod +x manuscript/define-deploy-dev/cdk8s.sh ./manuscript/define-deploy-dev/cdk8s.sh ``` -------------------------------- ### Execute Kubernetes Dashboard Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/dashboards/kubernetes-dashboard.md Makes the setup script executable and then runs it to install and configure the Kubernetes Dashboard. ```bash chmod +x manuscript/dashboards/kubernetes-dashboard.sh ./manuscript/dashboards/kubernetes-dashboard.sh ``` -------------------------------- ### Setup OpenFGA Environment with Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/access/openfga.md Makes the setup script executable, runs it to install OpenFGA and configure the environment, and sources the resulting .env file to load variables like FGA_API_URL. ```Bash chmod +x manuscript/access/openfga.sh ./manuscript/access/openfga.sh source .env ``` -------------------------------- ### Execute Devfile Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/devfile.md Makes the Devfile setup script executable and runs it to perform initial project configuration or setup tasks required before starting development. ```bash chmod +x manuscript/develop/devfile.sh ./manuscript/develop/devfile.sh ``` -------------------------------- ### Installing Traefik with Helm (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Installs or upgrades the Traefik Helm chart from its official repository. It installs Traefik into the `traefik` namespace (creating it if necessary) and waits for the installation to complete. Requires Helm and `kubectl` configured. ```bash helm upgrade --install traefik traefik \ --repo https://helm.traefik.io/traefik \ --namespace traefik --create-namespace --wait ``` -------------------------------- ### Execute Kustomize Setup Script Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/define-deploy-dev/kustomize.md Makes the Kustomize setup script executable and then runs it to perform initial setup steps required for the Kustomize configuration. ```bash chmod +x manuscript/define-deploy-dev/kustomize.sh ./manuscript/define-deploy-dev/kustomize.sh ``` -------------------------------- ### Setup Headlamp Dashboard using Devbox - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/dashboards/headlamp.md This snippet initializes the Devbox shell, makes the Headlamp setup script executable, and then runs the script to deploy the Headlamp dashboard. It requires Devbox to be installed and configured. ```bash devbox shell chmod +x manuscript/dashboards/headlamp.sh ./manuscript/dashboards/headlamp.sh ``` -------------------------------- ### Setup DevSpace Kustomize Script Execution (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/devspace-kustomize.md Makes the DevSpace Kustomize setup script executable and then runs it to perform initial project setup. ```bash chmod +x manuscript/develop/devspace-kustomize.sh ./manuscript/develop/devspace-kustomize.sh ``` -------------------------------- ### Forking and Cloning GitHub Repository (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Uses the GitHub CLI (`gh`) to fork the specified repository, clone it locally, change into the directory, and set the fork as the default repository for subsequent `gh` commands. Requires GitHub CLI to be installed and authenticated. ```bash # Watch https://youtu.be/BII6ZY2Rnlc if you are not familiar # with GitHub CLI. gh repo fork vfarcic/cncf-demo --clone --remote cd cncf-demo # Select the fork as the default repository gh repo set-default ``` -------------------------------- ### Setup Inspektor Gadget with Devbox Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/observability-misc/inspektor-gadget.md Initial setup steps using Devbox to enter the project shell and deploy the Inspektor Gadget components into the Kubernetes cluster. ```bash devbox shell kubectl gadget deploy ``` -------------------------------- ### Setup CDK8s App Script Execution (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/app/cdk8s.md Makes the cdk8s setup script executable, runs it, and sources the environment variables it might set as part of the initial setup phase. ```bash chmod +x manuscript/app/cdk8s.sh ./manuscript/app/cdk8s.sh source .env ``` -------------------------------- ### Setup Development Environment and Execute Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/progressive-delivery/flagger.md Initializes the development environment using `devbox shell`, makes the `flagger.sh` script executable, runs the script, and sources environment variables. This prepares the environment for progressive delivery setup. ```bash devbox shell # TODO: kapp-controller # TODO: Flux chmod +x manuscript/progressive-delivery/flagger.sh ./manuscript/progressive-delivery/flagger.sh source .env ``` -------------------------------- ### Prepare and Run Argo CD Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/gitops/argocd.md Makes the Argo CD setup script executable, runs it, and then sources the `.env` file to load environment variables. This is a prerequisite step for the subsequent Argo CD configuration. ```bash chmod +x manuscript/gitops/argocd.sh ./manuscript/gitops/argocd.sh source .env ``` -------------------------------- ### Setup Project with DevSpace Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/devspace-cdk8s.md Makes the setup script executable and then runs it to configure the project environment using DevSpace and cdk8s. ```bash chmod +x manuscript/develop/devspace-cdk8s.sh ./manuscript/develop/devspace-cdk8s.sh ``` -------------------------------- ### Setup Script Execution - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/app/kustomize.md This snippet prepares and executes a setup script for the Kustomize application and sources environment variables defined by the script. It requires the script file `manuscript/app/kustomize.sh` to exist and potentially a `.env` file it creates. ```bash chmod +x manuscript/app/kustomize.sh ./manuscript/app/kustomize.sh source .env ``` -------------------------------- ### Setting up Observability Environment (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/observability.md Enters the Devbox shell to load project dependencies, makes the observability setup script executable, runs the script, and sources the generated environment file to load variables. ```bash devbox shell chmod +x manuscript/setup/observability.sh ./manuscript/setup/observability.sh source .env ``` -------------------------------- ### Setup Crossplane AWS Provider and Environment Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/cluster/crossplane-aws.md Prepares the setup script for execution, runs it to install the Crossplane AWS provider and configure necessary credentials, and then sources the environment variables file for subsequent commands. ```bash chmod +x manuscript/cluster/crossplane-aws.sh ./manuscript/cluster/crossplane-aws.sh source .env ``` -------------------------------- ### Installing Cert-Manager with Helm (bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md These commands add the Jetstack Helm repository, update the local repository cache, and install cert-manager into the cert-manager namespace. The --set installCRDs=true flag ensures the necessary Custom Resource Definitions are installed. This step is skipped if nip.io is used. ```bash # Skip this step if you chose to use `nip.io` instead of a # "real" domain. helm repo add jetstack https://charts.jetstack.io # Skip this step if you chose to use `nip.io` instead of a # "real" domain. helm repo update # Skip this step if you chose to use `nip.io` instead of a # "real" domain. helm upgrade --install cert-manager jetstack/cert-manager \ --namespace cert-manager --create-namespace \ --set installCRDs=true --wait ``` -------------------------------- ### Execute SchemaHero Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db-schema/schemahero.md This snippet makes the SchemaHero setup script executable using `chmod +x` and then executes it. This is a necessary step to perform the initial setup or installation tasks defined within the script. ```bash chmod +x manuscript/db-schema/schemahero.sh ./manuscript/db-schema/schemahero.sh ``` -------------------------------- ### Example Helm Validation Output (Console) Source: https://github.com/vfarcic/cncf-demo/blob/main/kustomize/base/charts/postgresql/charts/common/README.md Shows the output of a `helm install` command when the validation helper detects empty required values, providing user guidance on how to set them. ```console $ helm install test mychart --set path.to.value00="",path.to.value01="" 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) ``` -------------------------------- ### Setup Pixie Environment and Run Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/metrics/pixie.md Enters the Devbox shell environment, makes the Pixie setup script executable, and then executes the script to configure Pixie. ```bash devbox shell chmod +x manuscript/metrics/pixie.sh ./manuscript/metrics/pixie.sh ``` -------------------------------- ### Configure Argo CD and Infrastructure Applications (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/gitops/argocd.md Installs Argo CD using Helm, creates an Argo CD Project, defines and copies Argo CD Application manifests for SchemaHero and cert-manager, commits these changes to Git, creates Argo CD Application manifests for grouping infrastructure and future applications, applies these manifests, checks resource status, configures the cert-manager issuer with email and ingress class, commits the issuer changes, and updates a settings file. ```bash # Install Argo CD and provide it with credentials to make changes to our cluster cat argocd/helm-values.yaml helm upgrade --install argocd argo-cd \ --repo https://argoproj.github.io/argo-helm \ --namespace argocd --create-namespace \ --values argocd/helm-values.yaml --wait # Create an Argo CD 'Project' cat argocd/project.yaml kubectl apply --filename argocd/project.yaml # Create a SchemaHero Application definition and store it in the infra folder ls -1 schema-hero cat argocd/schema-hero.yaml cp argocd/schema-hero.yaml infra/. # Create a cert-manager Application definition and store it in the infra folder cat argocd/cert-manager.yaml cp argocd/cert-manager.yaml infra/. # Commit to Git git add . git commit -m "Infra" git push # Create an Application definition for our application and call it 'production-apps' and point it at the 'apps' directory that is currently empty # Create an Application definition that groups the SchemaHero and cert-manager Applications into an Argo CD Application called 'production-infra' cat argocd/apps.yaml # Apply the 'production-apps' and 'production-infra' Applications to the cluster. The 'production-infra' Application will additionally deploy the Argo CD Applications that watch SchemaHero and cert-manager. However the 'production-apps' Application won't deploy any resources becuase the 'apps' directory is empty. kubectl apply --filename argocd/apps.yaml kubectl --namespace argocd get applications kubectl --namespace schemahero-system get all # Wait until the SchemaHero resources appear in the Namespace kubectl --namespace cert-manager get all # Wait until the cert-manager resources appear in the Namespace # Replace `[...]` with your email # Skip this step if you chose to use `nip.io` instead of a # "real" domain export EMAIL=[...] # Skip this step if you chose to use `nip.io` instead of a # "real" domain cat cert-manager/issuer.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain cp cert-manager/issuer.yaml infra/. # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace ".spec.acme.email = \"$EMAIL\"" infra/issuer.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace \ ".spec.acme.solvers[0].http01.ingress.class = \"$INGRESS_CLASS_NAME\"" \ infra/issuer.yaml # Commit to Git git add . git commit -m "Infra" git push yq --inplace ".gitOps.app = \"argocd\"" settings.yaml ``` -------------------------------- ### Setup DevSpace and Carvel ytt Script Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/devspace-carvel.md Makes the setup script executable and then runs it to prepare the environment for development with DevSpace and Carvel ytt. ```bash chmod +x manuscript/develop/devspace-carvel.sh ./manuscript/develop/devspace-carvel.sh ``` -------------------------------- ### Execute Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/https/cert-manager-kustomize.md Makes the setup script executable and then runs it. This script likely performs initial configuration or resource deployment necessary for the HTTPS setup. ```bash chmod +x manuscript/https/cert-manager-kustomize.sh ./manuscript/https/cert-manager-kustomize.sh ``` -------------------------------- ### Prepare and Execute Falco Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/runtime-policies/falco.md This snippet makes the Falco setup script executable and then runs it to configure runtime policies. ```bash chmod +x manuscript/runtime-policies/falco.sh ./manuscript/runtime-policies/falco.sh ``` -------------------------------- ### Setting up Argo CD using Shell Script Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/gitops-idp/kubecon-london-argocd.md This snippet executes a shell script located in the manuscript directory to perform the initial setup for Argo CD, as indicated by the 'Setup' section. ```sh ./manuscript/gitops-idp/argocd.sh ``` -------------------------------- ### Executing Setup Script (Shell) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/idp.md Makes the Nushell script 'dot.nu' executable, runs it with the arguments 'setup idp' to perform specific setup tasks, and then sources the '.env' file to load environment variables into the current shell session. ```sh chmod +x dot.nu ./dot.nu setup idp source .env ``` -------------------------------- ### Setup Nocalhost Development Environment in VSCode (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/nocalhost.md Opens the project in VSCode, configures the Nocalhost extension to use a specific kubeconfig, sets the development profile, adds the cluster, selects the deployment for development, opens the associated directory, and specifies a custom development image (golang:1.19). These steps are performed through the VSCode UI as guided by the comments. ```bash code . # Open the `Nocalhost` extension in VSCode # Change the Kube Config value to `kubeconfig-dev.yaml` in the # project directory # Set `dev` # Click the `Add Cluster` button # Open `dev` > `default` > `Workloads` > `Deployments` # Click the hammer icon next to `cncf-demo` # Click the `Open associated directory` button, select the # project directory and click the `Open` button # Select `Custom` as the development image and type `golang:1.19` # In the Nocalhost terminal ``` -------------------------------- ### Execute Crossplane Cloud Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-cloud.md This snippet provides the necessary commands to make a setup script executable and then run it. The script is intended to configure a cloud database using Crossplane. ```bash chmod +x manuscript/db/crossplane-cloud.sh ./manuscript/db/crossplane-cloud.sh ``` -------------------------------- ### Install Kubescape (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/scanning/kubescape.md Installs Kubescape using the official installation script and moves the binary to a standard system path for easy access. ```bash curl -s \ https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh \ | /bin/bash sudo mv ~/.kubescape/bin/kubescape /usr/local/bin/. ``` -------------------------------- ### Execute Keycloak Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/user-authentication/keycloak.md Makes the Keycloak setup script executable and then runs it. This script is part of the setup process for user authentication with Keycloak. ```bash chmod +x manuscript/user-authentication/keycloak.sh ./manuscript/user-authentication/keycloak.sh ``` -------------------------------- ### Add Bitnami Helm Repository (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/helm-cdk8s.md Adds the Bitnami Helm chart repository to the local Helm configuration and updates the list of available charts. This is a prerequisite for installing charts from Bitnami. ```bash helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update ``` -------------------------------- ### Setup Environment for GitOps with Kapp-controller (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/gitops/kapp.md Makes the `kapp.sh` script executable, runs it to perform initial setup steps, and then sources the `.env` file to load environment variables required for subsequent commands. ```bash chmod +x manuscript/gitops/kapp.sh ./manuscript/gitops/kapp.sh source .env ``` -------------------------------- ### Setup Environment Variables and Execute Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-google.md This snippet sets environment variables for the project ID and destination, makes a setup script executable, and then runs the script to provision resources. ```bash export XP_PROJECT_ID=dot-$(date +%Y%m%d%H%M%S) export XP_DESTINATION=google chmod +x manuscript/db/crossplane-google.sh ./manuscript/db/crossplane-google.sh ``` -------------------------------- ### Example: Validate Multiple Values Output (Console) Source: https://github.com/vfarcic/cncf-demo/blob/main/kustomize/overlays/dev/charts/postgresql/charts/common/README.md Shows the expected output when running `helm install` with empty values that are being validated by the template shown in the previous snippet, demonstrating the generated error messages and suggested commands. ```console $ helm install test mychart --set path.to.value00="",path.to.value01="" 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) ``` -------------------------------- ### Run Argo CD Ingress Setup Script - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/ingress/gitops-argocd.md Executes a setup script for Argo CD ingress and sources the environment variables it might generate or use. This prepares the environment for subsequent configuration steps. ```bash chmod +x manuscript/ingress/gitops-argocd.sh ./manuscript/ingress/gitops-argocd.sh source .env ``` -------------------------------- ### Setup Core Infrastructure Components Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/kubecon-london.md This bash script navigates to the project directory, pulls updates, enters a development shell, evaluates environment variables, and executes various setup commands using a './dot.nu' helper script for identity providers, KubeVela, Kyverno, ArgoCD, Argo Workflows, and Backstage. It also copies workflow files. ```bash cd cncf-demo git pull devbox shell eval "$(teller sh)" ./dot.nu setup idp source .env export GITHUB_USER=vfarcic ./dot.nu setup idp_kubevela $HYPERSCALER source .env ./dot.nu apply kyverno # ./dot.nu apply gatekeeper ./dot.nu setup idp_argocd # ./dot.nu apply flux cncf-demo-app export EMAIL=viktor@farcic.com ./dot.nu setup idp_argo_workflows $GITHUB_USER $GITHUB_TOKEN ./dot.nu apply backstage "0.0.3" \ --ingress_host "backstage.$INGRESS_HOST" \ --github_token $GITHUB_TOKEN \ --create_service_account true source .env cp workflows/* cncf-demo-app/. ``` -------------------------------- ### Execute Helm Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/app/helm.md Makes the Helm setup script executable and then runs it. Finally, sources the environment file to load necessary variables. ```bash chmod +x manuscript/app/helm.sh ./manuscript/app/helm.sh source .env ``` -------------------------------- ### Setup Kyverno Policies with Script (Shell) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/policies-idp/kubecon-london-kyverno.md Executes a shell script to set up Kyverno policies. This script likely handles the installation or configuration necessary for the policies discussed in the document. ```sh ./manuscript/policies-idp/kyverno.sh ``` -------------------------------- ### Executing KubeArmor Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/runtime-policies/kubearmor.md Makes the KubeArmor setup script executable and then runs it. This is part of the initial setup process for runtime policies. ```bash # TODO: kapp-controller chmod +x manuscript/runtime-policies/kubearmor.sh ./manuscript/runtime-policies/kubearmor.sh ``` -------------------------------- ### Setup Argo Rollouts Script Execution (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/progressive-delivery/argo-rollouts.md This snippet provides the necessary bash commands to prepare and execute the Argo Rollouts setup script. It first makes the script executable, then runs it, and finally sources the .env file, likely to load environment variables configured by the script. ```bash # TODO: kapp-controller chmod +x manuscript/progressive-delivery/argo-rollouts.sh ./manuscript/progressive-delivery/argo-rollouts.sh source .env ``` -------------------------------- ### Setup DevSpace and Helm Development Environment (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/devspace-helm.md Executes a setup script to prepare the environment for developing the application with DevSpace and Helm. ```bash chmod +x manuscript/develop/devspace-helm.sh ./manuscript/develop/devspace-helm.sh ``` -------------------------------- ### Setup Kubewarden Policies Script - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/policies/kubewarden.md Executes the Kubewarden setup script and sources the environment variables. Includes a placeholder for kapp-controller setup. ```bash # TODO: kapp-controller chmod +x manuscript/policies/kubewarden.sh ./manuscript/policies/kubewarden.sh source .env ``` -------------------------------- ### Install Prometheus (sh) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/service-mesh/istio.md Makes the Prometheus installation script executable and then runs it. This step should only be performed if Prometheus is not already installed. ```sh chmod +x manuscript/metrics/prometheus.sh ./manuscript/metrics/prometheus.sh ``` -------------------------------- ### Run Nushell Setup Script (Shell) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/gitops-idp/argocd.md Executes a Nushell script named dot.nu with 'setup' and 'idp_argocd' arguments. This script performs specific setup tasks related to identity providers and Argo CD. ```sh ./dot.nu setup idp_argocd ``` -------------------------------- ### Creating AWS EKS Cluster and EBS CSI Driver (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Sets AWS access key ID, secret access key, and account ID environment variables. Then, uses `eksctl` to create an EKS cluster based on a configuration file (`eksctl/config-dev.yaml`) and installs the AWS EBS CSI driver addon, associating it with a specified IAM role. Requires `eksctl` and AWS CLI configured. ```bash # Replace `[...]` with your access key ID` export AWS_ACCESS_KEY_ID=[...] # Replace `[...]` with your secret access key export AWS_SECRET_ACCESS_KEY=[...] # Replace `[...]` with your account ID export AWS_ACCOUNT_ID=[...] # Watch https://youtu.be/pNECqaxyewQ if you are not familiar # with `eksctl` eksctl create cluster --config-file eksctl/config-dev.yaml eksctl create addon --name aws-ebs-csi-driver --cluster dot \ --service-account-role-arn arn:aws:iam::$AWS_ACCOUNT_ID:role/AmazonEKS_EBS_CSI_DriverRole \ --force ``` -------------------------------- ### Setup Deployment Environment with Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/app/carvel.md Prepares the local environment for deployment by making the Carvel setup script executable, running it, and sourcing the generated environment variables. ```bash chmod +x manuscript/app/carvel.sh ./manuscript/app/carvel.sh source .env ``` -------------------------------- ### Deploying and Verifying PostgreSQL Setup (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db-production/kustomize.md A sequence of bash commands to configure Kustomize overlays for Crossplane-managed PostgreSQL resources, commit changes, push to git, check Kubernetes resources, and verify the application endpoint with curl. ```bash cat kustomize/overlays/prod/postgresql-crossplane-$XP_DESTINATION.yaml yq --inplace ".resources += \"postgresql-crossplane-$XP_DESTINATION.yaml\"" \ kustomize/overlays/prod/kustomization.yaml yq --inplace ".resources += \"postgresql-crossplane-secret-$XP_DESTINATION.yaml\"" \ kustomize/overlays/prod/kustomization.yaml cat kustomize/overlays/prod/deployment-crossplane-postgresql-$XP_DESTINATION.yaml yq --inplace ".patchesStrategicMerge = []" \ kustomize/overlays/prod/kustomization.yaml yq --inplace ".patchesStrategicMerge += \"deployment-crossplane-postgresql-$XP_DESTINATION.yaml\"" \ kustomize/overlays/prod/kustomization.yaml cat kustomize/overlays/prod/postgresql-crossplane-schema-$XP_DESTINATION.yaml # Execute the command that follows ONLY if you did NOT follow # the story from the start (if you jumped straight into this # chapter). yq --inplace ".resources += \"postgresql-crossplane-schema-$XP_DESTINATION.yaml\"" \ kustomize/overlays/prod/kustomization.yaml cat kustomize/overlays/prod/kustomization.yaml git add . git commit -m "App DB" git push kubectl get managed kubectl --namespace production get claim # Wait until it is `READY` # If you chose to use `nip.io` instead of a "real" domain, # replace `https` with `http`. curl "https://cncf-demo.$DOMAIN/videos" # If you chose to use `nip.io` instead of a "real" domain, # replace `https` with `http`. curl -X POST "https://cncf-demo.$DOMAIN/video?id=wNBG1-PSYmE&title=Kubernetes%20Policies%20And%20Governance%20-%20Ask%20Me%20Anything%20With%20Jim%20Bugwadia" # If you chose to use `nip.io` instead of a "real" domain, # replace `https` with `http`. curl -X POST "https://cncf-demo.$DOMAIN/video?id=VlBiLFaSi7Y&title=Scaleway%20-%20Everything%20We%20Expect%20From%20A%20Cloud%20Computing%20Service%3F" # If you chose to use `nip.io` instead of a "real" domain, # replace `https` with `http`. curl "https://cncf-demo.$DOMAIN/videos" | jq . ``` -------------------------------- ### Install Istio and Verify Namespace (sh) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/service-mesh/istio.md Makes the Istio installation script executable and runs it. Sources the environment variables and then checks the 'production' namespace configuration, waiting for the 'istio-injection' label. ```sh chmod +x manuscript/mtls/istio.sh ./manuscript/mtls/istio.sh source .env kubectl get namespace production --output yaml ``` -------------------------------- ### Execute Skooner Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/dashboards/skooner.md This snippet makes the Skooner setup script executable and then runs it. Ensure you have the necessary dependencies like 'gum' installed as mentioned in the setup instructions. ```bash chmod +x manuscript/dashboards/skooner.sh ./manuscript/dashboards/skooner.sh ``` -------------------------------- ### Setting up Prerequisites with Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/prod.md This script sets up the necessary environment for the project. It forks and clones the GitHub repository, sets the default repository, creates a Kubernetes namespace, modifies a settings file using `yq`, and optionally sets a curl alias. It requires GitHub CLI, kubectl, and yq. ```bash # Watch https://youtu.be/BII6ZY2Rnlc if you are not familiar with GitHub CLI gh repo fork vfarcic/cncf-demo --clone --remote cd cncf-demo # Select the fork as the default repository gh repo set-default # Create a Kubernetes cluster. # Do NOT use a local Kubernetes cluster (e.g., Docker Desktop, # Minikube, etc.). kubectl create namespace production # Install `yq` CLI from https://github.com/mikefarah/yq # 'yq' is a lightweight and portable command-line YAML processor yq --inplace ".image = \"index.docker.io/vfarcic/cncf-demo\"" \ settings.yaml yq --inplace ".tag = \"v0.0.1\"" settings.yaml # Execute this step ONLY if you chose to use `nip.io` instead of # a "real" domain alias curl="curl --insecure" ``` -------------------------------- ### Execute Helm Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/define-deploy-dev/helm.md Makes the Helm setup script executable and then runs it. This script configures the `ingress.host` and `image.repository` values in `helm/app/values.yaml` using environment variables that were set earlier. ```bash chmod +x manuscript/define-deploy-dev/helm.sh ./manuscript/define-deploy-dev/helm.sh ``` -------------------------------- ### Setup Policies with Script (Shell) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/policies-idp/kubecon-london-vap.md Executes a setup script for policies, likely related to Kubernetes Validating Admission Policies. ```sh ./manuscript/policies-idp/vap.sh ``` -------------------------------- ### Execute Istio Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/mtls/istio.md Makes the Istio setup script executable and runs it, then sources the environment variables file. This prepares the environment for the subsequent steps. ```bash chmod +x manuscript/mtls/istio.sh ./manuscript/mtls/istio.sh source .env ``` -------------------------------- ### Setup Prometheus Metrics Environment (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/metrics/prometheus.md Initializes the Devbox shell environment, makes the Prometheus setup script executable, and runs the script to configure metrics collection and monitoring tools like Prometheus and Grafana. ```bash devbox shell chmod +x manuscript/metrics/prometheus.sh ./manuscript/metrics/prometheus.sh ``` -------------------------------- ### Start Air for Live Reloading (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/nocalhost.md Executes the `air` command to start the live-reloading process for the Go application within the Nocalhost development environment. This command should be run in the Nocalhost terminal after installing `air`. ```bash air ``` -------------------------------- ### Setup Carvel ytt Script Execution - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/define-deploy-dev/carvel-ytt.md Provides the necessary commands to make the Carvel ytt setup script executable and then run it to prepare the environment. ```bash chmod +x manuscript/define-deploy-dev/carvel-ytt.sh ./manuscript/define-deploy-dev/carvel-ytt.sh ``` -------------------------------- ### Execute Logging Operator Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/data-pipelines/logging-operator.md Makes the logging operator setup script executable and then runs it. This script likely handles the installation and configuration of the Logging Operator and its components within the Kubernetes cluster. ```bash chmod +x manuscript/logging/logging-operator.sh ./manuscript/logging/logging-operator.sh ``` -------------------------------- ### Get SQLClaim Resource Status (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-carvel.md Retrieves the status of the SQLClaim resource named cncf-demo in the dev namespace using kubectl get sqlclaim. This shows the state of the requested database instance. ```bash kubectl --namespace dev get sqlclaim ``` -------------------------------- ### Setup Dragonfly with Docker Hub using Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/registry/dragonfly.md Configures environment variables for Docker Hub registry and username, logs into Docker Hub, changes permissions for the Dragonfly setup script, and executes the script to configure Dragonfly for Docker Hub and install it using Helm. ```bash # We're using Dragonfly with Docker Hub but it also works well with Harbor export REGISTRY=index.docker.io # Replace `[...]` with your Docker Hub username export DOCKERHUB_USERNAME=[...] # Tag your container image with the registry location export IMAGE=$REGISTRY/$DOCKERHUB_USERNAME/cncf-demo docker login --username $DOCKERHUB_USERNAME $REGISTRY # Change the permissions of this script chmod +x manuscript/registry/dragonfly.sh # Run the script. This does the following: # 1. Adds an “image” entry to settings.yaml and saves your image name for future use # 2. Creates a “values.yaml” file and adds the config that Dragonfly needs to use Docker Hub as the underlying image registry # 3. Installs Dragonfly using Helm ./manuscript/registry/dragonfly.sh ``` -------------------------------- ### Get Istio VirtualServices Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/progressive-delivery/kustomize.md Lists the VirtualService resources in the production namespace using kubectl. ```sh kubectl --namespace production get virtualservices ``` -------------------------------- ### Install Air for Go Live Reloading (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/develop/nocalhost.md Downloads and installs the `air` tool, a live-reloading utility for Go applications, into the `/go/bin` directory within the Nocalhost development container. This allows the application to automatically rebuild and restart when source code changes are detected. ```bash curl -sSfL \ https://raw.githubusercontent.com/cosmtrek/air/master/install.sh \ | sh -s -- -b /go/bin ``` -------------------------------- ### Install or Upgrade Helm Release Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-helm.md Deploys or updates the 'cncf-demo' Helm release in the 'dev' namespace using the chart located at 'helm/app'. ```bash helm upgrade --install cncf-demo helm/app --namespace dev ``` -------------------------------- ### Test Application Endpoint Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-helm.md Uses curl to make an HTTP GET request to the '/videos' endpoint of the deployed application, using a domain specified by the $DOMAIN environment variable. ```bash curl "https://cncf-demo-dev.$DOMAIN/videos" ``` -------------------------------- ### Setup PostgreSQL DB with Helm (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/helm-helm.md This script modifies the Helm chart files (Chart.yaml and values.yaml) using yq to add and configure a PostgreSQL dependency from the Bitnami repository. It then updates the Helm dependencies, deploys the chart using 'helm upgrade --install' into the 'dev' namespace, waits for the deployment to complete, and finally tests the deployment by curling a specific endpoint. Requires yq, helm, and curl. ```bash yq --inplace ".dependencies[0].name = \"postgresql\"" \ helm/app/Chart.yaml yq --inplace ".dependencies[0].version = \"12.1.2\"" \ helm/app/Chart.yaml yq --inplace \ ".dependencies[0].repository = \"https://charts.bitnami.com/bitnami\"" \ helm/app/Chart.yaml helm dep up helm/app cat helm/app/templates/deployment.yaml cat helm/app/values.yaml yq --inplace ".db.enabled.helm = true" helm/app/values.yaml cat helm/app/values.yaml helm upgrade --install cncf-demo helm/app --namespace dev --wait curl \"https://cncf-demo-dev.$DOMAIN/videos\" # Proceed further ONLY if the output contains # `relation \"videos\" does not exist`. ``` -------------------------------- ### Setting up Jaeger Tracing Environment (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/tracing/jaeger.md Initializes the devbox shell, makes the Jaeger setup script executable, and runs the script to configure tracing. ```bash devbox shell chmod +x manuscript/tracing/jaeger.sh ./manuscript/tracing/jaeger.sh ``` -------------------------------- ### Setting up local Crossplane environment (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-local.md This script sets the XP_DESTINATION environment variable to 'local', makes the 'manuscript/db/crossplane-local.sh' script executable, and then runs the script. This is typically used to configure and start a local Crossplane instance. ```bash export XP_DESTINATION=local chmod +x manuscript/db/crossplane-local.sh ./manuscript/db/crossplane-local.sh ``` -------------------------------- ### Getting Traefik Ingress IP (Non-EKS Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Retrieves the external IP address of the Traefik service in the `traefik` namespace using `kubectl` and sets it as the `INGRESS_HOST` environment variable. This command is intended for cloud providers other than AWS EKS. Requires `kubectl`. ```bash # If NOT EKS export INGRESS_HOST=$(kubectl --namespace traefik \ get service traefik \ --output jsonpath="{.status.loadBalancer.ingress[0].ip}") ``` -------------------------------- ### Configure Kustomize Overlay and Git Push - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/app/kustomize.md This sequence of commands copies the Kustomize definition, updates the image tag in the production overlay using environment variables, modifies ingress settings with `yq`, commits the changes to the Git repository, pushes them, and verifies the deployment and ingress status using `kubectl`. It depends on environment variables like `$GITOPS_APP`, `$IMAGE`, `$TAG`, `$DOMAIN`, and `$INGRESS_CLASS_NAME`, and requires `kustomize`, `yq`, `git`, and `kubectl` to be installed. ```bash cat $GITOPS_APP/cncf-demo-kustomize.yaml cp $GITOPS_APP/cncf-demo-kustomize.yaml apps/cncf-demo.yaml cd kustomize/overlays/prod kustomize edit set image $IMAGE=$IMAGE:$TAG cat kustomization.yaml cd ../../../ yq --inplace ".[0].value = \"cncf-demo.$DOMAIN\"" \ kustomize/overlays/prod/ingress.yaml yq --inplace ".[1].value = \"cncf-demo.$DOMAIN\"" \ kustomize/overlays/prod/ingress.yaml yq --inplace ".[2].value = \"$INGRESS_CLASS_NAME\"" \ kustomize/overlays/prod/ingress.yaml git add . git commit -m "cncf-demo v0.0.1" git push kubectl --namespace production get all,ingresses # If you chose to use `nip.io` instead of a "real" domain, # replace `https` with `http`. echo "https://cncf-demo.$DOMAIN" # Open it in a browser. ``` -------------------------------- ### Access Application Endpoint (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-carvel.md Sends an HTTP GET request to the /videos endpoint of the application, expected to be available at https://cncf-demo-dev.$DOMAIN, using curl. This verifies that the application is running and can potentially connect to the database. ```bash curl "https://cncf-demo-dev.$DOMAIN/videos" ``` -------------------------------- ### List Crossplane Managed Resources (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/db/crossplane-carvel.md Lists the Crossplane managed resources (XRs) in the cluster using kubectl get managed. This command shows the status of resources provisioned or managed by Crossplane, such as the PostgreSQL instance. ```bash kubectl get managed ``` -------------------------------- ### Execute Crossplane Setup Script (Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/cluster/crossplane.md This snippet first makes the `manuscript/cluster/crossplane.sh` script executable using `chmod +x` and then executes it. The script is responsible for installing and configuring Crossplane and its Kubernetes provider, which are necessary prerequisites for managing Kubernetes clusters with Crossplane. ```bash chmod +x manuscript/cluster/crossplane.sh ./manuscript/cluster/crossplane.sh ``` -------------------------------- ### Configure Argo CD Ingress and Deploy with Helm - Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/ingress/gitops-argocd.md Configures Argo CD Helm values and certificate YAML for ingress using `yq`, deploys or upgrades Argo CD with Helm, copies the certificate config, commits changes to Git, and outputs the Argo CD URL. Includes steps for both standard domains and `nip.io`. ```bash cat argocd/helm-values.yaml yq --inplace ".server.ingress.enabled = true" \ argocd/helm-values.yaml yq --inplace \ ".server.ingress.ingressClassName = \"$INGRESS_CLASS_NAME\"" \ argocd/helm-values.yaml yq --inplace ".server.ingress.hostname = \"gitops.$DOMAIN\"" \ argocd/helm-values.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace \ ".server.ingress.tls[0].hosts[0] = \"gitops.$DOMAIN\"" \ argocd/helm-values.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace ".server.ingress.tls[0].secretName = \"argocd\"" \ argocd/helm-values.yaml cat argocd/helm-values.yaml helm upgrade --install argocd argo-cd \ --repo https://argoproj.github.io/argo-helm \ --namespace argocd --create-namespace \ --values argocd/helm-values.yaml --wait # Skip this step if you chose to use `nip.io` instead of a # "real" domain cat argocd/certificate.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace ".spec.commonName = \"gitops.$DOMAIN\"" \ argocd/certificate.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain yq --inplace ".spec.dnsNames[0] = \"gitops.$DOMAIN\"" \ argocd/certificate.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain cat argocd/certificate.yaml # Skip this step if you chose to use `nip.io` instead of a # "real" domain cp argocd/certificate.yaml infra/. git add . git commit -m "Certificate" git push # Change `https` to `http` if you chose to use `nip.io` instead # of a "real" domain echo "https://gitops.$DOMAIN" # Open it in a browser # Login with the following credentials: # - Username: admin # - Password: admin123 ``` -------------------------------- ### Getting Traefik Ingress Hostname (EKS Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Retrieves the external hostname of the Traefik service in the `traefik` namespace using `kubectl` and sets it as the `INGRESS_HOSTNAME` environment variable. This command is specifically for AWS EKS clusters where the load balancer provides a hostname instead of an IP directly. Requires `kubectl`. ```bash # Only if you ARE using EKS export INGRESS_HOSTNAME=$(kubectl --namespace traefik \ get service traefik \ --output jsonpath="{.status.loadBalancer.ingress[0].hostname}") ``` -------------------------------- ### Setup Cluster API GCP Provider Bash Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/cluster/capi-google.md Exports environment variables required for Cluster API features and GCP credentials, installs the Cluster API GCP infrastructure provider, and updates a settings file. Requires a GCP credentials JSON file. ```bash # Export Environment Variables export CLUSTER_TOPOLOGY=true export EXP_CLUSTER_RESOURCE_SET=true export EXP_MACHINE_POOL=true export EXP_CAPG_GKE=true # Create the base64 encoded credentials by catting your credentials json. # This command uses your environment variables and encodes # them in a value to be stored in a Kubernetes Secret. # Replace `[...]` with the path to your gcp credentials json file. export GCP_B64ENCODED_CREDENTIALS=$( cat [...] | base64 | tr -d '\n' ) # Install ClusterAPI Provider for Google clusterctl init --infrastructure gcp yq --inplace ".capi.destination = \"google\"" settings.yaml ``` -------------------------------- ### Start Devbox Shell Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/progressive-delivery/istio.md Enters the Devbox shell environment, providing access to the project's defined tools and dependencies. This is a prerequisite for executing subsequent commands. ```sh devbox shell ``` -------------------------------- ### Resolving Traefik Ingress Hostname to IP (EKS Bash) Source: https://github.com/vfarcic/cncf-demo/blob/main/manuscript/setup/dev.md Uses the `dig` command to resolve the hostname stored in the `INGRESS_HOSTNAME` environment variable to an IP address and sets that IP address as the `INGRESS_HOST` environment variable. This is the final step to get the IP for EKS after obtaining the hostname. Requires `dig` and the `INGRESS_HOSTNAME` variable set. ```bash # Only if you ARE using EKS export INGRESS_HOST=$(dig +short $INGRESS_HOSTNAME) ```