Snapshots not working with Kubernetes 1.12 & RBAC
Closed this issue · 3 comments
glesperance commented
This might not be the actual cause ; but I updated my Kubernetes cluster to version 1.12 with RBAC and I can't get k8s-snapshots to work.
Every time it runs I get the following:
2019-07-23T20:38:18.595427Z Unhandled exception in main task [k8s_snapshots.__main__] loop=<_UnixSelectorEventLoop running=False closed=False debug=False> main_task=<Task finished coro=<daemon() done, defined at /usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py:444> exception=<SnapshotCreateError: Error creating snapshot data={}>> message=Unhandled exception in main task severity=ERROR structured_error=[{'type': 'AttributeError', 'message': "'NoneType' object has no attribute 'create_snapshot'", 'readable': ['Traceback (most recent call last):\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 99, in make_backup\n snapshot_description=serialize.dumps(rule),\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 171, in create_snapshot\n lambda: backend.create_snapshot(\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/asyncutils.py", line 12, in run_in_executor\n return await asyncio.get_event_loop().run_in_executor(None, func)\n', ' File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run\n result = self.fn(*self.args, **self.kwargs)\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 175, in <lambda>\n snapshot_description\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/backends/aws.py", line 102, in create_snapshot\n snapshot = connection.create_snapshot(\n', "AttributeError: 'NoneType' object has no attribute 'create_snapshot'\n"]}, {'type': 'SnapshotCreateError', 'message': 'Error creating snapshot', 'data': {}, 'readable': ['Traceback (most recent call last):\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/__main__.py", line 58, in main\n loop.run_until_complete(main_task)\n', ' File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete\n return future.result()\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 469, in daemon\n await asyncio.gather(*tasks)\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 438, in backuper\n await make_backup(ctx, current_target_rule)\n', ' File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 123, in make_backup\n ) from exc\n', 'k8s_snapshots.errors.SnapshotCreateError: SnapshotCreateError: Error creating snapshot {}\n']}]
2019-07-23T20:38:25.505967Z Shutdown complete [k8s_snapshots.__main__] message=Shutdown complete severity=INFO
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 99, in make_backup
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 171, in create_snapshot
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/asyncutils.py", line 12, in run_in_executor
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 175, in <lambda>
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/backends/aws.py", line 102, in create_snapshot
AttributeError: 'NoneType' object has no attribute 'create_snapshot'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/k8s-snapshots", line 11, in <module>
load_entry_point('k8s-snapshots==0.0.0', 'console_scripts', 'k8s-snapshots')()
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/__main__.py", line 58, in main
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 469, in daemon
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 438, in backuper
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 123, in make_backup
k8s_snapshots.errors.SnapshotCreateError: SnapshotCreateError: Error creating snapshot {}
I've track the error to a boto3 connection error but I can't understand why boto3.client('ec2', region_name=region)
would be returning None
Any idea what might be happening here?
glesperance commented
Alright, turns out I'm in luck!
This issue can be fixed by using the dev
image tag.
See PR #81
miracle2k commented
So this appears to be fixed in the master version then, so I'll close it.
glesperance commented
Awesome ; thanks for merging so quickly!