I deployed once using pulumi to a home built k8s c...
# getting-started
i
I deployed once using pulumi to a home built k8s cluster. I have another machine I'd like to use pulumi with, but refresh doesn't import anything. If I try to destroy the deployments using pulumi, it doesn't see them. Any advice on moving forward?
i'm guessing i should create an import script and run it before bringing in other machines to deploy from?
a
pulumi refresh
and
pulumi destroy
only effect resources that are managed by the Pulumi stack they are applied to. If you have a bunch of existing stuff deployed that you would like Pulumi to manage, you will need to import it.
i
gotcha. got importing services, but i'm having touble importing deploymenets
pulumi import --stack dev -y kubernetes:core/v1:Deployment demo default/demo
isn't importing my depoy named
demo
a
We have effectively reached the end of my k8s knowledge, but I can take a look if it is a generic Pulumi error. When you run the ☝️ import command, what happens?
i
Copy code
/app/src # pulumi import --stack dev -y kubernetes:core/v1:Deployment demo default/demo
Previewing import (dev):
     Type                              Name   Plan       Info  
     pulumi:pulumi:Stack               demo             1 error
 =   └─ kubernetes:core/v1:Deployment  demo   import     1 error

Diagnostics:
  kubernetes:core/v1:Deployment (demo):
    error: Preview failed: resource 'default/[secret]' does not exist

  pulumi:pulumi:Stack (demo-dev):
    error: preview failed
The names are probably not matching up
a
It looks like your using everything correctly as far as I can tell. If the deploy is named
demo
in k8s, I would try this if you haven’t already (just to see if it works):
Copy code
pulumi import --stack dev -y kubernetes:core/v1:Deployment demo demo
We have definitely reached the end of my knowledge. If someone else knows, please jump in. I would ask in #kubernetes, I think your odds of finding a more knowledgeable k8s user are higher their.
i
will do. i thought i need the namepace in there, but i tried w/o and got similar results. wish me luck 🤞
Found out the problem
if you do an
up -d
, the types are right there. I edited from
kubernetes:core/v1:Service
into
kubernetes:core/v1:Deployment
when it should be
kubernetes:apps/v1:Deployment
Doing an up -d shows the right types, and I botched editing
a
I’m glad you got it working.
s
how do you deploy on local hardware?