https://github.com/apple/pkl-k8s-examples
Examples for using Pkl with Kubernetes
https://github.com/apple/pkl-k8s-examples
Last synced: about 2 months ago
JSON representation
Examples for using Pkl with Kubernetes
- Host: GitHub
- URL: https://github.com/apple/pkl-k8s-examples
- Owner: apple
- License: apache-2.0
- Created: 2024-01-19T17:28:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T23:40:30.000Z (3 months ago)
- Last Synced: 2025-04-13T04:59:16.950Z (about 2 months ago)
- Language: Pkl
- Homepage:
- Size: 88.9 KB
- Stars: 223
- Watchers: 14
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
- Contributing: CONTRIBUTING.adoc
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.adoc
- Security: SECURITY.adoc
Awesome Lists containing this project
README
:uri-pkl: https://pkl-lang.org/main/current/index.html
:uri-pkl-intellij: https://pkl-lang.org/intellij/current/index.html
:uri-k8s-convert: https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/k8s.contrib/current/convert/index.html
:uri-k8s-templates: https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-k8s/k8s/current/K8sResource/index.html
:uri-k8s-app-env-cluster: https://pkl-lang.org/package-docs/pkg.pkl-lang.org/pkl-pantry/k8s.contrib.appEnvCluster/current/AppEnvCluster/index.html
:uri-pkl-comparison: https://pkl-lang.org/main/current/introduction/comparison.html
:uri-github-discussions: https://github.com/apple/pkl/discussions
:uri-pkl-install: https://pkl-lang.org/main/current/pkl-cli/index.html#homebrew= Pkl/K8s Examples
== What's In This Repo?
The <> directory contains YAML manifests for the official _guestbook_ Kubernetes example.
The <> example demonstrates how to
* convert YAML manifests to Pkl
* evaluate Pkl manifests back to YAML
* catch manifest errors during evaluation
* apply Pkl manifests to Kubernetes.The <> example demonstrates how to manage Pkl manifests for multiple applications, deployment environments, and Kubernetes clusters.
To run the examples, install the {uri-pkl-install}[Pkl CLI].
== Why Pkl/K8s?
Kubernetes requires a lot of YAML configuration.
To make a single configuration change, users often need to touch multiple YAML files, which is time-consuming and error-prone.
Configuration errors aren't discovered until the configuration is applied.{uri-k8s-templates}[Pkl/K8s], a set of {uri-pkl}[Pkl] templates derived from Kubernetes' OpenAPI spec, is here to save the day.
Writing Kubernetes manifests in Pkl offers the following benefits:* Strong local validation that goes beyond Kubernetes' OpenAPI spec.
* Easy sharing of configuration across applications, environments, and clusters with the {uri-k8s-app-env-cluster}[AppEnvCluster] Pkl template.
See the <> for details.
* Great IDE experience with validation, code completion, and direct access to Kubernetes documentation.
Requires the {uri-pkl-intellij}[Pkl IntelliJ Plugin] for JetBrains IDEs (IDEA, GoLand, PyCharm, etc).The {uri-k8s-convert}[io.k8s.convert] Pkl module automatically converts Kubernetes manifests from YAML to Pkl.
See the <> for details.Still unconvinced? See {uri-pkl-comparison}[Comparison] for the Pkl team's perspective on how Pkl compares to other configuration formats and languages,
== Where To Get Help?
* File a GitHub Issue.
* Ask a question on {uri-github-discussions}[GitHub discussions].