aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

aws eks update-kubeconfig errored out due to readonly file system

Open JiayangZhou opened this issue 1 year ago • 1 comments

Describe the bug

Our aws eks update-kubeconfig command got errored out in a read-only file system in a docker container, and we would like this error to be handled and raised more properly

2023-07-14 08:31:31,808 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2023-07-14 08:31:31,810 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/var/lang/lib/python3.8/site-packages/awscli/customizations/eks/kubeconfig.py", line 183, in write_kubeconfig
os.makedirs(directory)
File "/var/lang/lib/python3.8/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/var/lang/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/home/sbx_user1051'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/lang/lib/python3.8/site-packages/awscli/clidriver.py", line 217, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/var/lang/lib/python3.8/site-packages/awscli/clidriver.py", line 361, in __call__
return command_table[parsed_args.operation](remaining, parsed_globals)
File "/var/lang/lib/python3.8/site-packages/awscli/customizations/commands.py", line 187, in __call__
return self._run_main(parsed_args, parsed_globals)
File "/var/lang/lib/python3.8/site-packages/awscli/customizations/eks/update_kubeconfig.py", line 146, in _run_main
writer.write_kubeconfig(config)
File "/var/lang/lib/python3.8/site-packages/awscli/customizations/eks/kubeconfig.py", line 186, in write_kubeconfig
raise KubeconfigInaccessableError(
awscli.customizations.eks.kubeconfig.KubeconfigInaccessableError: Can't create directory for writing: [Errno 30] Read-only file system: '/home/sbx_user1051'
2023-07-14 08:31:31,839 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
Can't create directory for writing: [Errno 30] Read-only file system: '/home/sbx_user1051'
cat: /home/sbx_user1051/.kube/config: No such file or directory```

### Expected Behavior

error raised properly and give hints to users

### Current Behavior

not showing any error message

### Reproduction Steps

run aws eks update-kubeconfigin a read-only file system

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CLI version used

latest

### Environment details (OS name and version, etc.)

public.ecr.aws/lambda/python:3.8

JiayangZhou avatar Jul 14 '23 08:07 JiayangZhou