https://pulumi.com logo
#kubernetes
Title
# kubernetes
i

icy-jordan-58549

12/04/2020, 4:07 PM
if the configmap already exists inside the cluster (azure addons), can I somehow edit it using pulumi? Thanks
Copy code
error: resource kube-system/coredns-custom was not successfully created by the Kubernetes API server : configmaps "coredns-custom" already exists
b

big-potato-91793

12/05/2020, 12:55 PM
i think you could used the pulumi import feature.
i

icy-jordan-58549

12/07/2020, 8:48 AM
hm, looks very interesting, thanks! @big-potato-91793
@big-potato-91793 have you seen any examples? specifically using this with k8s. Thanks
b

big-potato-91793

12/07/2020, 1:06 PM
Copy code
const secret = new k8s.core.v1.Secret('secret', {
    metadata: {
        labels: {
            ...context.commonLabels
        },
        annotations: context.commonAnnotations
    },

}, {
    import: 'id-of-the-resources'
});
If you look at your object you’re trying to create, you always have the
CustomResourceOptions
that have the property
import
Copy code
/**
     * When provided with a resource ID, import indicates that this resource's provider should import its state from
     * the cloud resource with the given ID. The inputs to the resource's constructor must align with the resource's
     * current state. Once a resource has been imported, the import property must be removed from the resource's
     * options.
     */
    import?: ID;
i

icy-jordan-58549

12/07/2020, 2:58 PM
@big-potato-91793 I understand what you mean, but the problem on my side is AKS (Azure) install coredns on the resouerce init
I have no idea what’s the ID of that config map
basically, it’s configmap created in
kube-system
by azure on cluster init
g

gorgeous-egg-16927

12/07/2020, 4:57 PM
import id for k8s resources is
[namespace/]name
e.g.,
kube-system/my-config-map
you can also use the
pulumi import
command to handle this for you
i

icy-jordan-58549

12/07/2020, 5:20 PM
it can’t find it @gorgeous-egg-16927, already tried to use
ns/config-map
12 Views