diff --git a/docs-website/static/docs/walkthroughs/k3s_init.html b/docs-website/static/docs/walkthroughs/k3s_init.html new file mode 100644 index 0000000000..fdc2f69623 --- /dev/null +++ b/docs-website/static/docs/walkthroughs/k3s_init.html @@ -0,0 +1,99 @@ + + +
+ + + ++? Deploy this Zarf package? (y/N) Yes + +─────────────────────────────────────────────────────────────────────────────────────── +name: k3s +only: + localOS: linux + cluster: + architecture: amd64 +actions: + onDeploy: + defaults: + maxRetries: 5 + before: + - maxRetries: 0 + cmd: ./zarf internal is-valid-hostname + - cmd: "[ -e /etc/redhat-release ] && systemctl disable firewalld --now || echo ''" + after: + - cmd: systemctl daemon-reload + - cmd: systemctl enable k3s + - cmd: systemctl start k3s +files: +- source: packages/distros/k3s/common/zarf-clean-k3s.sh + target: /opt/zarf/zarf-clean-k3s.sh + executable: true +- source: packages/distros/k3s/common/k3s.service + target: /etc/systemd/system/k3s.service + symlinks: + - /etc/systemd/system/multi-user.target.wants/k3s.service +- source: https://github.com/k3s-io/k3s/releases/download/v1.24.1+k3s1/k3s + shasum: ca398d82fee8f9f52b05fb184582054be3c0285a1b9e8fb5c7b9a91448a + target: /usr/sbin/k3s + executable: true + symlinks: + - /usr/sbin/kubctl + - /usr/sbin/ctr + - /usr/sbin/crictl +- source: https://github.com/k3s-io/k3s/releases/download/v1.24.1+k3s1/k3s-airgap-images-amd64.tar.zst + shasum: 6736bf9fa4d5754d60b0508bafb2f888a70cb99a203a3a1617a919ca4ee74034 + target: /var/lib/rancher/k3s/agent/images/k3s.tar.zst + +*** REQUIRES ROOT *** Install K3s, certified Kubernetes distribution built for IoT & Edge computing +K3s provides the cluster need for Zarf running in Appliance Mode as well as can host a low-resource +Gitops Service if not using an existing Kubernetes platform. + +? Deploy the k3s component? (y/N) Yes +─────────────────────────────────────────────────────────────────────────────────────── + ++ + diff --git a/docs-website/static/docs/walkthroughs/zarf_init.html b/docs-website/static/docs/walkthroughs/zarf_init.html new file mode 100644 index 0000000000..25f24d1afd --- /dev/null +++ b/docs-website/static/docs/walkthroughs/zarf_init.html @@ -0,0 +1,423 @@ + + + + + + +
+$ zarf init+ + \ No newline at end of file diff --git a/docs/.images/walkthroughs/zarf_tools_monitor.png b/docs/.images/walkthroughs/zarf_tools_monitor.png new file mode 100644 index 0000000000..ddd2e22aa7 Binary files /dev/null and b/docs/.images/walkthroughs/zarf_tools_monitor.png differ diff --git a/docs/13-walkthroughs/1-initializing-a-k8s-cluster.md b/docs/13-walkthroughs/1-initializing-a-k8s-cluster.md index 09737058d3..ba7d74b190 100644 --- a/docs/13-walkthroughs/1-initializing-a-k8s-cluster.md +++ b/docs/13-walkthroughs/1-initializing-a-k8s-cluster.md @@ -1,42 +1,36 @@ # Initializing a K8s Cluster - -Before you're able to deploy an application package to a cluster, you need to initialize the cluster. This is done by running the [`zarf init`](../4-user-guide/1-the-zarf-cli/100-cli-commands/zarf_init.md) command. The `zarf init` command uses a specialized package that we have been calling an 'init-package'. More information about this specific package can be found [here](../4-user-guide/2-zarf-packages/3-the-zarf-init-package.md). -## Walkthrough Prerequisites +In this walkthrough, we will demonstrate how to initialize Zarf onto a K8s cluster. This is done by running the [`zarf init`](../4-user-guide/1-the-zarf-cli/100-cli-commands/zarf_init.md) command, which uses a specialized package called an 'init-package'. More information about this specific package can be found [here](../4-user-guide/2-zarf-packages/3-the-zarf-init-package.md). -1. The [Zarf](https://github.com/defenseunicorns/zarf) repository cloned: ([`git clone` Instructions](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)) -1. Zarf binary installed on your $PATH: ([Install Instructions](../3-getting-started.md#installing-zarf)) -1. An init-package built/downloaded: ([init-package Build Instructions](./0-using-zarf-package-create.md)) or ([Download Location](https://github.com/defenseunicorns/zarf/releases)) -1. A Kubernetes cluster to work with: ([Local k8s Cluster Instructions](./#setting-up-a-local-kubernetes-cluster)) +## Prerequisites -## Running the init Command - -Initializing a cluster is done with a single command, `zarf init`. +- The [Zarf](https://github.com/defenseunicorns/zarf) repository cloned: ([`git clone` Instructions](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)) +- Zarf binary installed on your $PATH: ([Install Instructions](../3-getting-started.md#installing-zarf)) +- An init-package built/downloaded: ([init-package Build Instructions](./0-using-zarf-package-create.md)) or ([Download Location](https://github.com/defenseunicorns/zarf/releases)) +- A Kubernetes cluster to work with: ([Local k8s Cluster Instructions](./#setting-up-a-local-kubernetes-cluster)) -```bash -# Ensure you are in the directory where the init-package.tar.zst is located +## Walkthrough -zarf init # Run the initialization command - # Type `y` when asked if we're sure that we want to deploy the package and hit enter - # Type `n` when asked if we want to deploy the 'k3s component' and hit enter - # Type `n` when asked if we want to deploy the 'logging component' and hit enter (optional) - # Type `n` when asked if we want to deploy the 'git-server component' and hit enter (optional) -``` +1. Run the `zarf init` command on your cluster. -### Confirming the Deployment +```sh +$ zarf init +``` -Just like how we got a prompt when creating a package in the prior walkthrough, we will also get a prompt when deploying a package. -![Confirm Package Deploy](../.images/walkthroughs/package_deploy_confirm.png) -Since there are container images within our init-package, we also get a notification about the [Software Bill of Materials (SBOM)](https://www.ntia.gov/SBOM) Zarf included for our package with the file location of where the [SBOM Dashboard](../7-dashboard-ui/1-sbom-dashboard.md) can be viewed. +2. When prompted to deploy the package select `y` for Yes, then hit the `enter` key.
+Using config file /Users/josimoore/Desktop/projects/zarf/zarf-config.toml + +Saving log file to +/var/folders/gb/qfjdrlp52_v87bj_2rfzqls00000gn/T/zarf-2023-03-28-08-39-23-314846914.log + + • Loading Zarf Package /Users/josimoore/.zarf-cache/zarf-init-arm64-v0.25.0.tar.zst + • Loading Zarf Package /Users/josimoore/.zarf-cache/zarf-init-arm64-v0.25.0.tar.zst + +kind: ZarfInitConfig +metadata: + name: init + description: Used to establish a new Zarf cluster + architecture: arm64 +build: + terminal: fv-az442-536 + user: runner + architecture: arm64 + timestamp: Tue, 21 Mar 2023 23:50:40 +0000 + version: v0.25.0 + migrations: + - scripts-to-actions +components: +- name: zarf-injector + description: | + Bootstraps a Kubernetes cluster by cloning a running pod in the cluster and hosting the registry image. + Removed and destroyed after the Zarf Registry is self-hosting the registry image. + required: true + cosignKeyPath: cosign.pub + files: + - source: sget://defenseunicorns/zarf-injector:arm64-2023-02-09 + target: "###ZARF_TEMP###/zarf-injector" + executable: true +- name: zarf-seed-registry + description: | + Deploys the Zarf Registry using the registry image provided by the Zarf Injector. + required: true + charts: + - name: docker-registry + releaseName: zarf-docker-registry + version: 1.0.0 + namespace: zarf + valuesFiles: + - packages/zarf-registry/registry-values.yaml + - packages/zarf-registry/registry-values-seed.yaml + localPath: packages/zarf-registry/chart +- name: zarf-registry + description: | + Updates the Zarf Registry to use the self-hosted registry image. + Serves as the primary docker registry for the cluster. + required: true + charts: + - name: docker-registry + releaseName: zarf-docker-registry + version: 1.0.0 + namespace: zarf + valuesFiles: + - packages/zarf-registry/registry-values.yaml + localPath: packages/zarf-registry/chart + manifests: + - name: registry-connect + namespace: zarf + files: + - packages/zarf-registry/connect.yaml + - name: kep-1755-registry-annotation + namespace: zarf + files: + - packages/zarf-registry/configmap.yaml + images: + - registry:2.8.1 +- name: zarf-agent + description: | + A Kubernetes mutating webhook to enable automated URL rewriting for container + images and git repository references in Kubernetes manifests. This prevents + the need to manually update URLs from their original sources to the Zarf-managed + docker registry and git server. + required: true + actions: + onCreate: + before: + - cmd: make init-package-local-agent AGENT_IMAGE="agent:v0.25.0" + manifests: + - name: zarf-agent + namespace: zarf + files: + - packages/zarf-agent/manifests/service.yaml + - packages/zarf-agent/manifests/secret.yaml + - packages/zarf-agent/manifests/deployment.yaml + - packages/zarf-agent/manifests/webhook.yaml + images: + - ghcr.io/defenseunicorns/zarf/agent:v0.25.0 +- name: logging + description: | + Deploys the Promtail Grafana & Loki (PGL) stack. + Aggregates logs from different containers and presents them in a web dashboard. + Recommended if no other logging stack is deployed in the cluster. + charts: + - name: loki-stack + releaseName: zarf-loki-stack + url: https://grafana.github.io/helm-charts + version: 2.9.9 + namespace: zarf + valuesFiles: + - packages/logging-pgl/pgl-values.yaml + manifests: + - name: logging-connect + namespace: zarf + files: + - packages/logging-pgl/connect.yaml + images: + - docker.io/grafana/promtail:2.7.2 + - grafana/grafana:8.3.5 + - grafana/loki:2.6.1 + - quay.io/kiwigrid/k8s-sidecar:1.19.2 +- name: git-server + description: | + Deploys Gitea to provide git repositories for Kubernetes configurations. + Required for GitOps deployments if no other git server is available. + actions: + onDeploy: + after: + - maxTotalSeconds: 60 + maxRetries: 3 + cmd: ./zarf internal create-read-only-gitea-user + charts: + - name: gitea + releaseName: zarf-gitea + url: https://dl.gitea.io/charts + version: 7.0.4 + namespace: zarf + valuesFiles: + - packages/gitea/gitea-values.yaml + manifests: + - name: git-connect + namespace: zarf + files: + - packages/gitea/connect.yaml + images: + - gitea/gitea:1.18.5 +variables: +- name: K3S_ARGS + description: Arguments to pass to K3s + default: --disable traefik +- name: REGISTRY_EXISTING_PVC + description: "Optional: Use an existing PVC for the registry instead of creating a new one. If this is set, the REGISTRY_PVC_SIZE variable will be ignored." +- name: REGISTRY_PVC_SIZE + description: The size of the persistent volume claim for the registry + default: 20Gi +- name: REGISTRY_CPU_REQ + description: The CPU request for the registry + default: 100m +- name: REGISTRY_MEM_REQ + description: The memory request for the registry + default: 256Mi +- name: REGISTRY_CPU_LIMIT + description: The CPU limit for the registry + default: "3" +- name: REGISTRY_MEM_LIMIT + description: The memory limit for the registry + default: 2Gi +- name: REGISTRY_HPA_MIN + description: The minimum number of registry replicas + default: "1" +- name: REGISTRY_HPA_MAX + description: The maximum number of registry replicas + default: "5" +- name: REGISTRY_HPA_ENABLE + description: Enable the Horizontal Pod Autoscaler for the registry + default: "true" +- name: GIT_SERVER_EXISTING_PVC + description: "Optional: Use an existing PVC for the git server instead of creating a new one. If this is set, the GIT_SERVER_PVC_SIZE variable will be ignored." +- name: GIT_SERVER_PVC_SIZE + description: The size of the persistent volume claim for git server + default: 10Gi +- name: GIT_SERVER_CPU_REQ + description: The CPU request for git server + default: 200m +- name: GIT_SERVER_MEM_REQ + description: The memory request for git server + default: 512Mi +- name: GIT_SERVER_CPU_LIMIT + description: The CPU limit for git server + default: "3" +- name: GIT_SERVER_MEM_LIMIT + description: The memory limit for git server + default: 2Gi +constants: +- name: AGENT_IMAGE + value: agent:v0.25.0 +This package has 9 artifacts with software bill-of-materials (SBOM) included. You can view them now +in the zarf-sbom folder in this directory or to go directly to one, open this in your browser: +/Users/josimoore/Desktop/projects/zarf/zarf-sbom/sbom-viewer-docker.io_grafana_promtail_2.7.2.html + +* This directory will be removed after package deployment. + +? Deploy this Zarf package? (y/N) Yes + +─────────────────────────────────────────────────────────────────────────────────────── +name: k3s +only: + localOS: linux + cluster: + architecture: amd64 +actions: + onDeploy: + defaults: + maxRetries: 5 + before: + - maxRetries: 0 + cmd: ./zarf internal is-valid-hostname + - cmd: "[ -e /etc/redhat-release ] && systemctl disable firewalld --now || echo ''" + after: + - cmd: systemctl daemon-reload + - cmd: systemctl enable k3s + - cmd: systemctl start k3s +files: +- source: packages/distros/k3s/common/zarf-clean-k3s.sh + target: /opt/zarf/zarf-clean-k3s.sh + executable: true +- source: packages/distros/k3s/common/k3s.service + target: /etc/systemd/system/k3s.service + symlinks: + - /etc/systemd/system/multi-user.target.wants/k3s.service +- source: https://github.com/k3s-io/k3s/releases/download/v1.24.1+k3s1/k3s + shasum: ca398d82fee8f9f52b05fb184582054be3c0285a1b9e8fb5c7b9a91448a + target: /usr/sbin/k3s + executable: true + symlinks: + - /usr/sbin/kubctl + - /usr/sbin/ctr + - /usr/sbin/crictl +- source: https://github.com/k3s-io/k3s/releases/download/v1.24.1+k3s1/k3s-airgap-images-amd64.tar.zst + shasum: 6736bf9fa4d5754d60b0508bafb2f888a70cb99a203a3a1617a919ca4ee74034 + target: /var/lib/rancher/k3s/agent/images/k3s.tar.zst + +*** REQUIRES ROOT *** Install K3s, certified Kubernetes distribution built for IoT & Edge computing +K3s provides the cluster need for Zarf running in Appliance Mode as well as can host a low-resource +Gitops Service if not using an existing Kubernetes platform. + +? Deploy the k3s component? (y/N) No + +─────────────────────────────────────────────────────────────────────────────────────── + +name: logging +charts: +- name: loki-stack + releaseName: zarf-loki-stack + url: https://grafana.github.io/helm-charts + version: 2.9.9 + namespace: zarf + valuesFiles: + - packages/logging-pgl/pgl-values.yaml +manifests: +- name: logging-connect + namespace: zarf + files: + - packages/logging-pgl/connect.yaml +images: +- docker.io/grafana/promtail:2.7.2 +- grafana/grafana:8.3.5 +- grafana/loki:2.6.1 +- quay.io/kiwigrid/k8s-sidecar:1.19.2 + +Deploys the Promtail Grafana & Loki (PGL) stack. Aggregates logs from different containers and +presents them in a web dashboard. Recommended if no other logging stack is deployed in the cluster. + +? Deploy the logging component? (y/N) No + +─────────────────────────────────────────────────────────────────────────────────────── + +name: git-server +actions: + onDeploy: + after: + - maxTotalSeconds: 60 + maxRetries: 3 + cmd: ./zarf internal create-read-only-gitea-user +charts: +- name: gitea + releaseName: zarf-gitea + url: https://d1.gitea.io/charts + version: 7.0.4 + namespace: zarf + valuesFiles: + - packages/gitea/gitea-values.yaml +manifests: +- name: git-connect + namespace: zarf + files: + - packages/gitea/connect.yaml +images: +- gitea/gitea:1.18.5 + +Deploys Gitea to provide git repositories for Kubernetes configurations. Required for GitOps +deployments if no other git server is available. +? Deploy the git-server component? (y/N) No + ++ + 📦 ZARF-INJECTOR COMPONENT + + ++ + • Copying 1 files + • Copying 1 files + • Gathering cluster information + • Gathering cluster information + • Attempting to bootstrap the seed image into the cluster + • Attempting to bootstrap the seed image into the cluster + ++ + 📦 ZARF-SEED-REGISTRY COMPONENT + + ++ + • Loading the Zarf State from the Kubernetes cluster + • Loading the Zarf State from the Kubernetes cluster + • Processing helm chart docker-registry:1.0.0 from Zarf-generated helm chart + • Processing helm chart docker-registry:1.0.0 from Zarf-generated helm chart + ++ + 📦 ZARF-REGISTRY COMPONENT + + ++ + • Opening tunnel 62270 -> 5000 for svc/zarf-docker-registry in namespace zarf + • Creating port forwarding tunnel at http://127.0.0.1:62270/v2/_catalog + • Storing images in the zarf registry + • Storing images in the zarf registry + • Processing helm chart docker-registry:1.0.0 from Zarf-generated helm chart + • Processing helm chart docker-registry:1.0.0 from Zarf-generated helm chart + • Starting helm chart generation registry-connect + • Starting helm chart generation registry-connect + • Processing helm chart raw-init-zarf-registry-registry-connect:0.1.1680014363 from Zarf-generated + helm chart + • Processing helm chart raw-init-zarf-registry-registry-connect:0.1.1680014363 from Zarf-generated + helm chart + • Starting helm chart generation kep-1755-registry-annotation + • Starting helm chart generation kep-1755-registry-annotation + • Processing helm chart raw-init-zarf-registry-kep-1755-registry-annotation:0.1.1680014363 from + Zarf-generated helm chart + • Processing helm chart raw-init-zarf-registry-kep-1755-registry-annotation:0.1.1680014363 from + Zarf-generated helm chart + ++ + 📦 ZARF-AGENT COMPONENT + + ++ + • Opening tunnel 62284 -> 5000 for svc/zarf-docker-registry in namespace zarf + • Creating port forwarding tunnel at http://127.0.0.1:62284/v2/_catalog + • Storing images in the zarf registry + • Storing images in the zarf registry + • Starting helm chart generation zarf-agent + • Starting helm chart generation zarf-agent + • Processing helm chart raw-init-zarf-agent-zarf-agent:0.1.1680014363 from Zarf-generated helm chart + • Processing helm chart raw-init-zarf-agent-zarf-agent:0.1.1680014363 from Zarf-generated helm chart + ✔ Zarf deployment complete + + + Application | Username | Password | Connect + Registry | zarf-push | DdarrzTahz6oclGTUAUOfbsY | zarf connect registry + + +