### Install Kubit CLI Tool Source: https://context7.com/kubecfg/kubit/llms.txt Installs the kubit CLI tool for local development and management. Available via Homebrew or from source. ```bash # macOS / Linux via Homebrew brew install kubecfg/kubit/kubit # From source via cargo cargo install --git https://github.com/kubecfg/kubit/ --tag v0.0.22 ``` -------------------------------- ### Install Kubit CLI via Homebrew Source: https://github.com/kubecfg/kubit/blob/main/README.md Install the Kubit CLI tool using Homebrew, a popular package manager for macOS and Linux. ```bash brew install kubecfg/kubit/kubit ``` -------------------------------- ### Install Kubit Controller (Single Namespace Mode) Source: https://context7.com/kubecfg/kubit/llms.txt Installs the kubit controller scoped to a specific namespace using Role/RoleBinding and ConfigMap for configuration. Suitable for namespace-specific deployments. ```bash # Install the controller scoped to a single namespace kubectl apply -k 'https://github.com/kubecfg/kubit//kustomize/single-namespace?ref=v0.0.22' \ -n my-application-namespace # Supply the AppInstance definition via a ConfigMap kubectl create configmap -n my-application-namespace app-instance \ --from-file=app-instance=my-appinstance.yaml ``` -------------------------------- ### Start Local Controller for Paused Instances Source: https://context7.com/kubecfg/kubit/llms.txt Start the local controller to process only paused `AppInstance` resources. This is used when running the controller locally alongside an existing in-cluster controller. ```bash # Start the local controller, processing only paused instances cargo run -- --as system:serviceaccount:kubit:kubit --only-paused ``` -------------------------------- ### Install Kubit in Single Namespace Source: https://github.com/kubecfg/kubit/blob/main/README.md Apply the single-namespace flavor of the kustomize package to install Kubit in a specific application namespace. This method requires only a Role and RoleBinding, and does not need the CRD. ```bash kubectl apply -k 'https://github.com/kubecfg/kubit//kustomize/single-namespace?ref=v0.0.22' -n ``` -------------------------------- ### Install Kubit CLI via Cargo Source: https://github.com/kubecfg/kubit/blob/main/README.md Install the Kubit CLI directly from its Git repository using cargo, Rust's package manager. Specify the desired tag for version control. ```bash cargo install --git https://github.com/kubecfg/kubit/ --tag v0.0.22 ``` -------------------------------- ### Install Kubit Kubernetes Controller Source: https://github.com/kubecfg/kubit/blob/main/README.md Apply the Kubit operator to your Kubernetes cluster using Kustomize. Ensure you are using the correct ref for the desired version. ```bash kubectl apply -k 'https://github.com/kubecfg/kubit//kustomize/global?ref=v0.0.22' ``` -------------------------------- ### Apply with Docker Dependencies Source: https://context7.com/kubecfg/kubit/llms.txt Run `kubit` and `kubectl` within Docker containers by using the `--docker` flag, eliminating the need for local installations. ```bash # Run kubecfg and kubectl inside Docker containers — no local installs required kubit local apply foo.yaml --docker ``` -------------------------------- ### Use Docker for kubit Dependencies Source: https://github.com/kubecfg/kubit/blob/main/README.md Execute kubit's dependencies within Docker containers by using the `--docker` flag. This is an alternative if you prefer not to install `kubectl` and `kubecfg` directly on your system. ```bash kubit local apply foo.yaml --docker ``` -------------------------------- ### Render AppInstance Logs with Kubectl and jq Source: https://github.com/kubecfg/kubit/blob/main/README.md Extract and format the last logs from an AppInstance's status field for more readable output. This uses kubectl to get the resource and jq to parse the status.lastLogs. ```bash kubectl get -f foo.yaml -o json | jq -r '.status.lastLogs|to_entries[] | "\(.key): \(.value)"' ``` -------------------------------- ### Prepare Release Script Source: https://github.com/kubecfg/kubit/blob/main/docs/release-process.md Utilize this helper script to bump the version in various text files. Ensure you provide the desired version as an argument. ```bash scripts/prepare_release.sh ``` -------------------------------- ### Emit Apply Shell Script Source: https://context7.com/kubecfg/kubit/llms.txt Print the shell commands `kubit` would run to apply resources for a given `AppInstance` using `kubit scripts --app-instance ... apply`. ```bash # Emit the kubectl apply script kubit scripts --app-instance foo.yaml apply ``` -------------------------------- ### Build and Run Local Controller Source: https://context7.com/kubecfg/kubit/llms.txt Build and run the controller process locally, impersonating the `kubit` service account. This is used for local development without an in-cluster deployment. ```bash # Build and run the controller process locally, impersonating the kubit service account cargo run -- --as system:serviceaccount:kubit:kubit ``` -------------------------------- ### Emit Render Shell Script Source: https://context7.com/kubecfg/kubit/llms.txt Print the shell commands `kubit` would run to render resources for a given `AppInstance` using `kubit scripts --app-instance ... render`. ```bash # Emit the kubecfg render script kubit scripts --app-instance foo.yaml render ``` -------------------------------- ### Run Kubit Controller Locally Source: https://github.com/kubecfg/kubit/blob/main/README.md Build and run the Kubit controller locally. The '--as' flag specifies the identity the controller will use. ```bash cargo run -- --as system:serviceaccount:kubit:kubit ``` -------------------------------- ### Try Local Package Changes with kubit CLI Source: https://github.com/kubecfg/kubit/blob/main/README.md Test local jsonnet code changes before packaging and publishing by using the `--package-image file://` flag with `kubit local apply --dry-run=diff`. This allows you to preview changes against your local files. ```bash kubit local apply foo.yaml --dry-run=diff --package-image file://$HOME/my-project/my-main.jsonnet ``` -------------------------------- ### Create AppInstance ConfigMap Source: https://github.com/kubecfg/kubit/blob/main/README.md Create a ConfigMap named 'app-instance' in the application namespace. The 'data' field should contain a key 'app-instance' with the YAML definition of the AppInstance. ```bash kubectl create configmap -n mycoolapp app-instance --from-file=app-instance=example-kubit-testing.yaml ``` -------------------------------- ### List OCI Images Referenced by Package Source: https://context7.com/kubecfg/kubit/llms.txt Enumerate all container images referenced by a package using `kubit metadata images`. This is useful for pre-pulling images or configuring private mirrors. ```bash kubit metadata images foo.yaml # ghcr.io/kubecfg/demo:v0.1.0 # registry.k8s.io/kubectl:v1.28.0 # ghcr.io/kubecfg/kubecfg/kubecfg:v0.17.1 ``` -------------------------------- ### Deploy Package with AppInstance Source: https://context7.com/kubecfg/kubit/llms.txt Defines and applies an AppInstance custom resource to deploy a package. The spec.package.image points to an OCI artifact, and spec.package.spec provides configuration values. ```yaml apiVersion: kubecfg.dev/v1alpha1 kind: AppInstance metadata: name: foo namespace: myns spec: package: image: ghcr.io/kubecfg/demo:v0.1.0 apiVersion: demo/v1alpha1 spec: bar: baz replicas: 3 ingress: enabled: true host: foo.example.com ``` ```bash kubectl apply -f foo.yaml ``` -------------------------------- ### Preview Deletion Script Source: https://context7.com/kubecfg/kubit/llms.txt Use `--dry-run=script` with `kubit local delete` to preview the deletion script without actually running it. ```bash # Preview the deletion script without running it kubit local delete foo.yaml --dry-run=script ``` -------------------------------- ### Create a New Package with kubecfg pack Source: https://github.com/kubecfg/kubit/blob/main/README.md Use the `kubecfg pack` command to bundle a jsonnet file and its dependencies into an OCI artifact. This command pushes the bundle to a specified OCI registry image. ```bash kubecfg pack ghcr.io/kubecfg/demo:v0.1.0 demo.jsonnet ``` -------------------------------- ### Apply Local Development Manifests Source: https://github.com/kubecfg/kubit/blob/main/README.md Apply Kubernetes resources for local development without spawning the Kubit controller. These manifests are typically found in the './kustomize/local' directory. ```bash kubectl apply -k ./kustomize/local ``` -------------------------------- ### Apply Package Locally with kubit CLI Source: https://github.com/kubecfg/kubit/blob/main/README.md Use the `kubit local apply` command to render and apply a package locally from a YAML definition. This command mimics the controller's behavior but runs on the CLI. ```bash kubit local apply foo.yaml ``` -------------------------------- ### Unpause AppInstance to Hand Back Control Source: https://context7.com/kubecfg/kubit/llms.txt Unpause an `AppInstance` to return control to the in-cluster controller after local development is complete. ```bash # When done, unpause to hand control back to the in-cluster controller kubectl patch -f foo.yaml --patch '{"spec":{"pause": false}}' --type merge ``` -------------------------------- ### Override Package Image for Apply Source: https://context7.com/kubecfg/kubit/llms.txt Test local Jsonnet changes before publishing by overriding the package image with a local file path using `--package-image`. ```bash # Use a local jsonnet file instead of the OCI image in the AppInstance spec kubit local apply foo.yaml \ --dry-run=diff \ --package-image file://$HOME/my-project/main.jsonnet ``` -------------------------------- ### Run Local Controller with Paused Resources Source: https://github.com/kubecfg/kubit/blob/main/README.md Run the locally built Kubit controller with the '--only-paused' flag. This ensures the controller only processes AppInstance resources that have been explicitly paused. ```bash cargo run -- --as system:serviceaccount:kubit:kubit --only-paused ``` -------------------------------- ### Generate CRD Manifests to Stdout Source: https://context7.com/kubecfg/kubit/llms.txt Write Custom Resource Definition (CRD) manifests to standard output using `kubit manifests`. ```bash # Write CRDs to stdout kubit manifests ``` -------------------------------- ### Generate CRD Manifests to Directory Source: https://context7.com/kubecfg/kubit/llms.txt Write Custom Resource Definition (CRD) manifests to a specified directory using `kubit manifests --crd-dir`. ```bash # Write CRDs to a directory kubit manifests --crd-dir ./kustomize/crd/bases ``` -------------------------------- ### Pack Jsonnet Project into OCI Artifact Source: https://context7.com/kubecfg/kubit/llms.txt Use `kubecfg pack` to bundle a Jsonnet project and its dependencies into an OCI artifact, which is then pushed to a registry. This is the standard way to produce bundles consumed by `kubit`. ```bash # Pack demo.jsonnet and all its dependencies into an OCI image kubecfg pack ghcr.io/my-org/demo:v0.2.0 demo.jsonnet # Pull and inspect the resulting image crane manifest ghcr.io/my-org/demo:v0.2.0 | jq . ``` -------------------------------- ### Dry Run Script with kubit CLI Source: https://github.com/kubecfg/kubit/blob/main/README.md Preview the actual commands that `kubit local apply` will execute without applying them by using the `--dry-run=script` flag. This is useful for understanding the underlying operations. ```bash kubit local apply foo.yaml --dry-run=script ``` -------------------------------- ### Interactive Diff Before Apply Source: https://context7.com/kubecfg/kubit/llms.txt View a diff of pending changes and interactively confirm before applying resources using the `--diff` flag. ```bash # Show a diff of pending changes and interactively confirm before applying kubit local apply foo.yaml --diff # Apply? [y/N] ``` -------------------------------- ### AppInstance with Private Registry Credentials Source: https://context7.com/kubecfg/kubit/llms.txt Configures an AppInstance to pull packages from a private OCI registry using specified imagePullSecrets. Ensure the secret is of type kubernetes.io/dockerconfigjson. ```yaml apiVersion: kubecfg.dev/v1alpha1 kind: AppInstance metadata: name: demo namespace: myns spec: imagePullSecrets: - name: gar-docker-secret # kubernetes.io/dockerconfigjson Secret package: image: gcr.io/my-org/package-demo:v1 apiVersion: mymkg.pub/v1alpha1 spec: foo: bar ``` ```bash kubectl apply -f demo-with-secrets.yaml ``` -------------------------------- ### Kubit Local Apply Dry-Run Modes Source: https://context7.com/kubecfg/kubit/llms.txt Performs dry-run operations for applying an AppInstance manifest locally. Supports rendering manifests to stdout or diffing against the cluster state. ```bash # Render manifests to stdout only (no apply) kubit local apply foo.yaml --dry-run=render # Render and diff against the running cluster kubit local apply foo.yaml --dry-run=diff ``` -------------------------------- ### Create Git Tag Source: https://github.com/kubecfg/kubit/blob/main/docs/release-process.md Create a new tag for the release following semantic versioning. Use 'v' prefix for the tag name. ```git git tag v0.0.22 ``` -------------------------------- ### Retrieve JSON Schema for Package Spec Source: https://context7.com/kubecfg/kubit/llms.txt Fetch the JSON schema for a package's `spec` from the registry using `kubit metadata schema`. This is useful for validating `AppInstance` spec values before applying. ```bash kubit metadata schema foo.yaml # { # "$schema": "http://json-schema.org/draft-07/schema#", # "properties": { # "bar": { "type": "string" }, # "replicas": { "type": "integer", "default": 1 } # } # } ``` -------------------------------- ### Apply CRD and RBAC for Local Development Source: https://context7.com/kubecfg/kubit/llms.txt Apply the Custom Resource Definition (CRD) and Role-Based Access Control (RBAC) configurations locally without deploying the in-cluster controller. ```bash # Apply only the CRD and RBAC (no in-cluster controller Pod) kubectl apply -k ./kustomize/local ``` -------------------------------- ### Dry Run Diff with kubit CLI Source: https://github.com/kubecfg/kubit/blob/main/README.md Render and diff the manifests against a running application without applying changes by using the `--dry-run=diff` flag. This is useful for previewing the effects of spec changes or version updates. ```bash kubit local apply foo.yaml --dry-run=diff ``` -------------------------------- ### Observe AppInstance Status with Kubectl and jq Source: https://github.com/kubecfg/kubit/blob/main/README.md Retrieve the status of an AppInstance resource using kubectl and format the output as JSON. The jq tool is used to extract the status field. ```bash kubectl get -f foo.yaml -o json | jq .status ``` -------------------------------- ### Dry Run Render with kubit CLI Source: https://github.com/kubecfg/kubit/blob/main/README.md Render the YAML manifests for a package without applying them by using the `--dry-run=render` flag. This allows you to inspect the generated manifests. ```bash kubit local apply foo.yaml --dry-run=render ``` -------------------------------- ### Pause AppInstance for Local Controller Source: https://context7.com/kubecfg/kubit/llms.txt Pause a specific `AppInstance` to ensure only the local controller processes it. This is part of the workflow for running the controller locally alongside an existing in-cluster controller. ```bash # Pause a specific AppInstance so only the local controller processes it kubectl patch -f foo.yaml --patch '{"spec":{"pause": true}}' --type merge ``` -------------------------------- ### Pause AppInstance for Local Controller Source: https://github.com/kubecfg/kubit/blob/main/README.md Pause an AppInstance resource by patching its spec to 'pause: true'. This allows the locally run controller to process only this specific resource without interfering with an existing in-cluster controller. ```bash kubectl patch -f foo.yaml --patch '{"spec":{"pause": true}}' --type merge ``` -------------------------------- ### Apply AppInstance CR with Kubectl Source: https://github.com/kubecfg/kubit/blob/main/README.md Apply a custom resource definition (CR) for an AppInstance to your Kubernetes cluster using kubectl. This CR references an OCI artifact for the application package. ```yaml apiVersion: kubecfg.dev/v1alpha1 kind: AppInstance metadata: name: foo namespace: myns spec: package: image: ghcr.io/kubecfg/demo:v0.1.0 apiVersion: demo/v1alpha1 spec: bar: baz ``` ```bash kubectl apply -f foo.yaml ``` -------------------------------- ### Push Git Tag Source: https://github.com/kubecfg/kubit/blob/main/docs/release-process.md Push the newly created tag to the remote repository to trigger CI. ```git git push origin ``` -------------------------------- ### Unpause AppInstance Resource Source: https://github.com/kubecfg/kubit/blob/main/README.md Resume processing of an AppInstance resource by patching its spec to 'pause: false'. This reverts the pause action taken previously. ```bash kubectl patch -f foo.yaml --patch '{"spec":{"pause": false}}' --type merge ``` -------------------------------- ### Delete Resources Owned by AppInstance Source: https://context7.com/kubecfg/kubit/llms.txt Remove all Kubernetes resources created by an applyset using `kubit local delete`. This leverages `kubectl apply --prune` for cleanup. ```bash kubit local delete foo.yaml ``` -------------------------------- ### Pause and Resume AppInstance Reconciliation Source: https://context7.com/kubecfg/kubit/llms.txt Temporarily halts or resumes the reconciliation process for an AppInstance. Useful for manual interventions or local development. ```bash # Pause kubectl patch -f foo.yaml --patch '{"spec":{"pause": true}}' --type merge # Resume kubectl patch -f foo.yaml --patch '{"spec":{"pause": false}}' --type merge ``` -------------------------------- ### Check AppInstance Reconciliation Status Source: https://context7.com/kubecfg/kubit/llms.txt Retrieves and inspects the reconciliation status, conditions, and logs of an AppInstance. Useful for debugging and monitoring. ```bash # View full status as JSON kubectl get -f foo.yaml -o json | jq .status # Pretty-print per-container logs from the last reconciliation Job kubectl get -f foo.yaml -o json \ | jq -r '.status.lastLogs | to_entries[] | "\(.key): \(.value)"' # Watch status conditions kubectl get appinstances -n myns -w # NAME IMAGE APIVERSION PAUSED REASON STATUS # foo ghcr.io/kubecfg/demo:v0.1.0 demo/v1alpha1 false JobCompletedSuccessfully True ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.