kops: AWS iam node roles missing permissions for dockerconfig and addons
/kind bug
1. What kops version are you running? The command kops version, will display
this information.
Client version: 1.26.2
2. What Kubernetes version are you running? kubectl version will print the
version if a cluster is running or provide the Kubernetes version specified as
a kops flag.
1.26.3
3. What cloud provider are you using?
AWS
4. What commands did you run? What is the simplest way to reproduce this issue? Kops upgrade to kubernetes version 1.26
5. What happened after the commands executed? I went to rotate the master nodes, however noticed that some of the control plane containers weren’t coming up due to 401. We use our own private container registry. I did some investigation and noticed the dockerconfig file was not getting populated on all the EC2 instances. I then worked out that the IAM roles were missing the required s3 permissions for these two locations:
/secrets/dockerconfig
/addons/*
As a temporary fix i have added the S3 permissions into the additionalPolicies section.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 16 (9 by maintainers)
I just had a long (and somewhat frustrating) debugging episode that turned out to be caused by this issue.
This is on kOps 1.28.1 with AWS, Kubernetes 1.26.11, using Gossip DNS.
My problem was that regular nodes did not get a
/root/.docker/config.jsonon first boot, despite having adockerconfigsecret. Control-plane nodes did however get them. Looking through thenodeuplogs I see that it tried to read the secret:As I saw no following error I assumed it had succeeded, but I also noticed that there was no File task in the logs for writing the secret to disk and chmoding it.
Looking through the source I see that s3fs read errors are actually swallowed by the
VFSSecretStoreReader. First here:https://github.com/kubernetes/kops/blob/2038e4c08fe6a1f768e607ed14988cc929bf52f9/upup/pkg/fi/secrets/vfs_secretstorereader.go#L76-L83
So the error is not returned unless it’s a 404 and the code will go on and try to JSON unmarshal 0 bytes. This will shadow the actual error with an
unexpected end of JSON inputerror. But this error is in turn swallowed by the caller:https://github.com/kubernetes/kops/blob/2038e4c08fe6a1f768e607ed14988cc929bf52f9/nodeup/pkg/model/secrets.go#L52
I patched
nodeupwith logging of the errors and restartedkops-configuration.serviceto see what was happening:Looking at the node IAM policy (
nodes.dev.k8s.local) it was obvious that it had no access to thedockerconfigsecret ons3://<redacted>-kops-state/dev.k8s.local/secrets/dockerconfig:Some questions:
kops-controllerbootstrapping and therefore no secrets from there?dockerconfigis not supported with Gossip DNS, shouldn’t it be documented somewhere?nodeupintentional, or should I file a separate issue about it?+1, this is a pretty significant breaking change, and it seems like it was a conscious decision to remove the feature gate to keep existing behavior.
Is there a documented alternative or some other way to restore the previous behavior?