Hi, I'd like to ask how do you solve deploying k8s...
# kubernetes
a
Hi, I'd like to ask how do you solve deploying k8s deployment with image tagged
latest
. I've got running deployment and newer image, but for pulumi there is no change? How to "redeploy" deployment to download latest latest image.
f
That doesn't sound right to me. Could it be that your kubernetes yaml files are not set up right? Possibly the `imagePullPolicy` config?
a
Hi,
imagePullPolicy
is ok. I use
Always
but common problem for deploying something with
latest
tag is that k8s does not recognize the change as manifests are the same. My question may state if pulumi has something to solve this issue, but as I think about it can't as this is based on k8s structure and declarative definitions in manifests.
Basically it's recommended not to use
latest
f
Depending on if you can query your registry from Pulumi you could do something like this (using AWS ECR):
Copy code
const imageDetails = aws.ecr.getImageOutput({
  imageTag: 'latest',
  repositoryName: 'company-name/my-service',
})

const image = pulumi.interpolate`${imageDetails.repositoryName}@sha256:${imageDetails.imageDigest}}`
assuming
imageDetails.imageDigest
does not include the
sha256:
suffix (I have not tested this). I have used this approach with Ansible + Cloudformation (with ECS) in the past and it worked well.