pulumi-digitalocean
pulumi-digitalocean copied to clipboard
Unable to upgrade cluster verion
Following the tutorial from DO.
Cluster was created with:
const cluster = new digitalocean.KubernetesCluster("do-cluster", {
region: digitalocean.Regions.SFO2,
version: "latest",
nodePool: {
name: "default",
size: digitalocean.DropletSlugs.DropletS2VCPU2GB,
nodeCount: 3,
},
});
Randomly (~ every second run), I am getting the following error:
5:17:09.528[ do-cluster] * updating urn:pulumi:dev::pulum::digitalocean:index/kubernetesCluster:KubernetesCluster::do-cluster: Unable to upgrade cluster verion: POST https://api.digitalocean.com/v2/kubernetes/clusters/${uuid}/upgrade: 404 cluster not found
Could you please provide the diff when you perform an update?
Hey sorry, I don't have the code base anymore, I was just testing it out. But I was follow the DO tutorial to the letter. So you can try their code. It started happening almost right off the bat.
Also, I did check the cluster UUID from the URL, and it did match the ID in the UI.
I've managed to repo this with the example above, the problem is the use of latest
in the version field. If you send the same request to the DO API, it returns a 404 (which seems a strange response?)
curl -X POST -H "Content-Type: application/json" -d '{"version": "latest"}' -H "Authorization: Bearer ${DO_TOKEN}" "https://api.digitalocean.com/v2/kubernetes/clusters/f3286a91-6001-44c9-842e-9da1e86163b0/upgrade"
{"id":"not_found","message":"cluster not found"}
if you send an actual version number, it works as expected:
curl -X POST -H "Content-Type: application/json" -d '{"version": "1.16.6-do.2"}' -H "Authorization: Bearer ${DO_TOKEN}" "https://api.digitalocean.com/v2/kubernetes/clusters/f3286a91-6001-44c9-842e-9da1e86163b0/upgrade"
The version code should get the version dynamically like we do in our examples
version: digitalocean.getKubernetesVersions({versionPrefix: "1.16"}).then(p => p.latestVersion),
I'll try to get the source post updated, which is located here:
https://www.digitalocean.com/community/tutorials/how-to-manage-digitalocean-and-kubernetes-infrastructure-with-pulumi
@jaxxstorm ah, makes sense! Thank you for explaining.
I'm guessing version is optional to begin with? Or it can be just hardcoded to a specific version. I can see it being a bit dangerous to just upgrade the version randomly during a deployment.
@moltar absolutely! You can set the version as a string like so:
const cluster = new digitalocean.KubernetesCluster("do-cluster", {
region: digitalocean.Regions.SFO2,
version: "1.16.6-do.2",
nodePool: {
name: "default",
size: digitalocean.DropletSlugs.DropletS2VCPU2GB,
nodeCount: 3,
},
});
Using the 'latest' const string, i have issues with upgrading the node pool, but this function do the job:
async function getKubernetesVersions() {
const versions = digitalocean.getKubernetesVersions({});
return await (await versions).latestVersion;
}
U can easily change in other supported languages.