Provide a way to export Kubernetes YAML
See original GitHub issueBeing able to export Kubernetes YAML will be important, especially for certain classes of users who may already have existing tools and practices for deployments. The challenge we have, and have always had due to the fact that evaluations can depend on output properties (the same reason we can’t produce plans ahead of time), but there are still things we can do to make this better. For instance:
-
Show as much of the YAML as possible for a preview, even if there are “holes” in it.
-
Emit the fully resolved YAML “as we go” so that it can be checkpointed in the usual way. For instance, folks practicing “GitOps”
In the first case, someone could always take the output and apply it with kubectl
. In fact, if we had a mode that rejected holes, and emitted resources in the correct order based on DAG dependency order, then we could just step out of the way and it would still be an improvement over today’s practices.
Both of these seem imminently doable and something we should strongly consider.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:19 (11 by maintainers)
My use case: I’d like to use Pulumi to bootstrap my infrastructure (GCP, GKE, CloudSQL, PubSub, etc), and create some k8s secrets for credentials into the created cluster… But I don’t want to deploy my applications into the cluster through Pulumi. Rather, I might define Kubernetes Deployment & Service via Pulumi, then render that to YaML and have Argo CD manage synchronizing the pulumi-rendered YaML into the k8s cluster.
Argo has a plugin feature that seems like it could work: https://argoproj.github.io/argo-cd/user-guide/config-management-plugins/
This isn’t a complete solution, however I do want to note that
pulumi preview
supports a--json
option. As Levi says, there is a potential for missing values since they might not be known in advance due to dependencies, etc.; however, mixed with somejq
magic, we can get close.For instance, given this program:
We can run this command:
The output is the following YAML:
Not 100% of what we’re after here, but very close …