Say I've got a large yaml file / text I don't want...
# general
w
Say I've got a large yaml file / text I don't want to initially convert to pulumi objects. What's the best way to deploy this to k8s as is?
w
There is
k8s.yaml.ConfigFile(...)
that you can point at some yaml and deploy that via Pulumi.
w
I hit an issue trying to re-parent my yaml config from the node group to the cluster. It wants to create before delete when everything has the same name.
Copy code
Type                                                                 Name                       Plan       
     pulumi:pulumi:Stack                                                  k8s-infra-dev                         
     └─ eks:index:Cluster                                                 Dev-Eks                               
 +      ├─ kubernetes:yaml:ConfigFile                                     fluent-bit.yml             create     
 +      │  ├─ kubernetes:core:ServiceAccount                              default/fluent-bit         create     
 +      │  ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRoleBinding|rbac.authorization.k8s.io:ClusterRoleBinding>     fluent-bit-read            create     
 +      │  ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRole|rbac.authorization.k8s.io:ClusterRole>            fluent-bit-read            create     
 +      │  ├─ kubernetes:core:ConfigMap                                   default/fluent-bit-config  create     
 +      │  └─ kubernetes:apps:DaemonSet                                   default/fluent-bit         create     
        └─ eks:index:NodeGroup                                            Dev-Eks-nodeGroup                     
 -         └─ kubernetes:yaml:ConfigFile                                  fluent-bit.yml             delete     
 -            ├─ kubernetes:core:ServiceAccount                           default/fluent-bit         delete     
 -            ├─ kubernetes:apps:DaemonSet                                default/fluent-bit         delete     
 -            ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRoleBinding|rbac.authorization.k8s.io:ClusterRoleBinding>  fluent-bit-read            delete     
 -            ├─ kubernetes:core:ConfigMap                                default/fluent-bit-config  delete     
 -            └─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRole|rbac.authorization.k8s.io:ClusterRole>         fluent-bit-read            delete
Copy code
Type                                                              Name                       Status                  Info
     pulumi:pulumi:Stack                                               k8s-infra-dev              **failed**              1 error
     └─ eks:index:Cluster                                              Dev-Eks                                            
 +      └─ kubernetes:yaml:ConfigFile                                  fluent-bit.yml             created                 
 +         ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRoleBinding|rbac.authorization.k8s.io:ClusterRoleBinding>  fluent-bit-read            **creating failed**     1 error
 +         ├─ kubernetes:core:ServiceAccount                           default/fluent-bit         **creating failed**     1 error
 +         ├─ kubernetes:<http://rbac.authorization.k8s.io:ClusterRole|rbac.authorization.k8s.io:ClusterRole>         fluent-bit-read            **creating failed**     1 error
 +         ├─ kubernetes:core:ConfigMap                                default/fluent-bit-config  **creating failed**     1 error
 +         └─ kubernetes:apps:DaemonSet                                default/fluent-bit         **creating failed**     1 error
 
Diagnostics:
  pulumi:pulumi:Stack (k8s-infra-dev):
    error: update failed
 
  kubernetes:core:ServiceAccount (default/fluent-bit):
    error: Plan apply failed: resource default/fluent-bit was not successfully created by the Kubernetes API server : serviceaccounts "fluent-bit" already exists
 
  kubernetes:<http://rbac.authorization.k8s.io:ClusterRoleBinding|rbac.authorization.k8s.io:ClusterRoleBinding> (fluent-bit-read):
    error: Plan apply failed: resource fluent-bit-read was not successfully created by the Kubernetes API server : <http://clusterrolebindings.rbac.authorization.k8s.io|clusterrolebindings.rbac.authorization.k8s.io> "fluent-bit-read" alread
y exists
 
  kubernetes:<http://rbac.authorization.k8s.io:ClusterRole|rbac.authorization.k8s.io:ClusterRole> (fluent-bit-read):
    error: Plan apply failed: resource fluent-bit-read was not successfully created by the Kubernetes API server : <http://clusterroles.rbac.authorization.k8s.io|clusterroles.rbac.authorization.k8s.io> "fluent-bit-read" already exist
s
 
  kubernetes:apps:DaemonSet (default/fluent-bit):
    error: Plan apply failed: resource default/fluent-bit was not successfully created by the Kubernetes API server : daemonsets.apps "fluent-bit" already exists
 
  kubernetes:core:ConfigMap (default/fluent-bit-config):
    error: Plan apply failed: resource default/fluent-bit-config was not successfully created by the Kubernetes API server : configmaps "fluent-bit-config" already exists
... and it won't let me specify
deleteBeforeReplace
Not sure if it's due to my misunderstanding or if this should be supported somehow
Resolved by running in two phases; first without resource so it's deleted, then with new parent.
w
If you are reparenting resources, you can use
aliases
to indicate what name the resources used to have so that you avoid the need to delete and recreate. https://www.pulumi.com/docs/intro/concepts/programming-model/#aliases
w
Ah right