pulumi: Snapshot integrity failure when redeploying a Kubernetes cluster
I changed properties on an azure kubernetes cluster which required it to be redeployed, but when running the update the cluster was replaced and then I got the following error:
error: .pulumi\stacks\deveu.json: snapshot integrity failure; refusing to use it: resource urn:pulumi:deveu::deveu::kubernetes:yaml:ConfigFile$kubernetes:core/v1:Namespace::cert-manager refers to unknown provider urn:pulumi:deveu::deveu::pulumi:providers:kubernetes::deveu1::f2568e12-b0c3-42c3-8900-357f6d9c218b
The cluster was replaced but then the update immediately threw an error and wouldn’t proceed until I manually edited the state file to remove all the kubernetes resources. All of these resources had “pendingReplacement: true” but referenced the old provider which had been deleted.
const kubeCluster = new azure.containerservice.KubernetesCluster(args.Name, {
name: args.ClusterArgs.name,
resourceGroupName: args.ResourceGroup.name,
location: args.Location,
defaultNodePool: {
name: args.AgentPoolProfileName,
vmSize: args.NodeSize,
nodeCount: args.NodeCount,
maxPods: args.MaxPods
},
networkProfile: {
loadBalancerSku: args.LoadBalancerSku,
networkPlugin: "azure"
},
dnsPrefix: args.DnsPrefix,
servicePrincipal: {
clientId: principal.Application.applicationId,
clientSecret: principal.ServicePrincipalPassword.value
},
roleBasedAccessControl: {
enabled: true
}
}, {
dependsOn: [secret, acrRole, ...dependsOn],
protect: true,
parent: args.Parent,
aliases: [{ parent: pulumi.rootStackResource }],
additionalSecretOutputs: ["kubeConfigs", "kubeConfigRaw", "kubeAdminConfigs", "kubeAdminConfigRaw"],
ignoreChanges: ["defaultNodePool.nodeCount"]
});
const provider = new kubernetes.Provider(args.Name, {
kubeconfig: kubeCluster.kubeConfigRaw
}, {
parent: args.Parent,
aliases: [{ parent: pulumi.rootStackResource }]
});
const certManager = new kubernetes.yaml.ConfigFile(
"cert-manager",
{ file: "https://github.com/jetstack/cert-manager/releases/download/v0.9.1/cert-manager.yaml", },
{ providers: { kubernetes: provider } }
);
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 17
- Comments: 19 (5 by maintainers)
My error was
I did: 1.
pulumi refreshpulumi upAnd it helped.
how is this issue still open after 3 years? the overlap between pulumi users and k8s users must be huge. can someone from pulumi have a look at and prioritize this issue? @mikhailshilkov
This is a bug that Pulumi should fix, imo.
For now, I think understanding the bug will help anyone work around the issue safely. If you have a single stack creating a cluster and k8s resources together, then you must be configuring the k8s provider using the cluster’s certs. When you recreate a cluster, the cert’s change. The bug is the k8s provider doesn’t pick up these new certs. It is still somehow attached to old (bad) certs. When it tries to recreate the new k8s resources, it fails.
These steps are a workaround. You have to remove all k8s resources from the stack. After that, run again and it will work.
Still an issue - it seems provider dependencies are not being respected properly? This happens on GKE too.