Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Padding error during k8s module operation #42605

Closed
Tzrlk opened this issue Jul 11, 2018 · 6 comments
Closed

Incorrect Padding error during k8s module operation #42605

Tzrlk opened this issue Jul 11, 2018 · 6 comments
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. k8s module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.

Comments

@Tzrlk
Copy link

Tzrlk commented Jul 11, 2018

SUMMARY

When attempting to use the k8s module to deploy a ClusterRole component used in Traefik, an error is produced citing "Incorrect Padding" related to the kube config.
All related files: https://gist.github.com/Tzrlk/b5ecafe3eb5adeabeed4796b5b33f1a9

ISSUE TYPE
  • Bug Report
COMPONENT NAME

k8s

ANSIBLE VERSION
ansible 2.5.5
  config file = /work/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Feb 22 2018, 21:59:35) [GCC 6.3.0]
CONFIGURATION

DEFAULT_HOST_LIST(/work/ansible.cfg) = [u'/work/inventories']
DEFAULT_ROLES_PATH(/work/ansible.cfg) = [u'/work/.imported_roles', u'/work/roles']
DEFAULT_VAULT_PASSWORD_FILE(/work/ansible.cfg) = /work/.build/ansible/vault-pass

OS / ENVIRONMENT

docker container running on Windows 10 based on williamyeh/ansible:alpine3 with the following additions:
apk: gcc, musl-dev, python2-dev
pip:* ansible, boto3, botocore, openshift
additionally: heptio-authenticator-aws

Ansible project directory is mounted to /work inside the container.

STEPS TO REPRODUCE

Using the files from https://gist.github.com/Tzrlk/b5ecafe3eb5adeabeed4796b5b33f1a9, attempt to deploy to the running cluster via docker run --rm -v /c/code/devops/ansible://work -e http_proxy=http://proxy:3128/ -e https_proxy=http://proxy:3128/ -e no_proxy=127.0.0.1,localhost,local tzrlk/ansible ansible-playbook -vvv playbooks/k8s_virginia.yml

EXPECTED RESULTS

Expected the resource to be applied in the same manner as kubectl apply -f

ACTUAL RESULTS

Instead, an "Incorrect Padding" error was produced, and playbook execution halted.

docker run --rm -v /c/code/devops/ansible://work -e http_proxy=http://proxy:3128/ -e https_proxy=http://proxy:3128/ -e no_proxy=127.0.0.1,localhost,local tzrlk/ansible ansible-playbook -vvv \
		playbooks/k8s_virginia.yml
ansible-playbook 2.5.5
  config file = /work/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.14 (default, Feb 22 2018, 21:59:35) [GCC 6.3.0]
Using /work/ansible.cfg as config file
Parsed /work/inventories/localhost.yml inventory source with yaml plugin

PLAYBOOK: k8s_virginia.yml *****************************************
1 plays in playbooks/k8s_virginia.yml

PLAY [Set up kubernetes resources] *****************
META: ran handlers

TASK [k8s_cluster : Set up Kubernetes authentication] **********************
task path: /work/roles/k8s_cluster/tasks/main.yml:3
included: /work/roles/k8s_cluster/tasks/auth.yml for localhost

TASK [k8s_cluster : Ensure aws config directory exists] ********************
task path: /work/roles/k8s_cluster/tasks/auth.yml:3
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902 `" && echo ansible-tmp-1531261686.22-40206080020902="` echo /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902 `" ) && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpfTA4pc TO /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902/file.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902/ /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902/file.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902/file.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261686.22-40206080020902/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "diff": {
        "after": {
            "path": "/root/.aws", 
            "state": "directory"
        }, 
        "before": {
            "path": "/root/.aws", 
            "state": "absent"
        }
    }, 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "delimiter": null, 
            "diff_peek": null, 
            "directory_mode": null, 
            "follow": true, 
            "force": false, 
            "group": null, 
            "mode": null, 
            "original_basename": null, 
            "owner": null, 
            "path": "/root/.aws", 
            "recurse": false, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "directory", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "mode": "0755", 
    "owner": "root", 
    "path": "/root/.aws", 
    "size": 4096, 
    "state": "directory", 
    "uid": 0
}

TASK [k8s_cluster : Generate aws profile configuration] ********************
task path: /work/roles/k8s_cluster/tasks/auth.yml:8
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336 `" && echo ansible-tmp-1531261686.41-17595121613336="` echo /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/stat.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpNQHDX5 TO /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/ /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/stat.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/stat.py && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpexZUoE TO /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/source
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/ /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/source && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/copy.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpX2TBMT TO /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/copy.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/ /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "checksum": "607d0740ae706e7d42c9f296f93390c94ecd4ec0", 
    "dest": "/root/.aws/config", 
    "diff": [], 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": false, 
            "checksum": "607d0740ae706e7d42c9f296f93390c94ecd4ec0", 
            "content": null, 
            "delimiter": null, 
            "dest": "/root/.aws/config", 
            "directory_mode": null, 
            "follow": false, 
            "force": true, 
            "group": null, 
            "local_follow": null, 
            "mode": null, 
            "original_basename": "tmpexZUoE", 
            "owner": null, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/source", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "md5sum": "7b72a9804ed7e810b388c9e92cd25a02", 
    "mode": "0644", 
    "owner": "root", 
    "size": 51, 
    "src": "/root/.ansible/tmp/ansible-tmp-1531261686.41-17595121613336/source", 
    "state": "file", 
    "uid": 0
}

TASK [k8s_cluster : Generate aws profile credentials config] ***************
task path: /work/roles/k8s_cluster/tasks/auth.yml:13
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403 `" && echo ansible-tmp-1531261687.07-195161353424403="` echo /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/stat.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpzMR7c4 TO /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/ /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/stat.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/stat.py && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmp_TbjGz TO /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/source
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/ /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/source && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/copy.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpy6nZtq TO /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/copy.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/ /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "checksum": "fdd5709fcb09ffd1609526c4fb1b8c97af5a39bd", 
    "dest": "/root/.aws/credentials", 
    "diff": [], 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": false, 
            "checksum": "fdd5709fcb09ffd1609526c4fb1b8c97af5a39bd", 
            "content": null, 
            "delimiter": null, 
            "dest": "/root/.aws/credentials", 
            "directory_mode": null, 
            "follow": false, 
            "force": true, 
            "group": null, 
            "local_follow": null, 
            "mode": null, 
            "original_basename": "tmp_TbjGz", 
            "owner": null, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/source", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "md5sum": "58a27335e5096c98dcc080dee3661e60", 
    "mode": "0644", 
    "owner": "root", 
    "size": 128, 
    "src": "/root/.ansible/tmp/ansible-tmp-1531261687.07-195161353424403/source", 
    "state": "file", 
    "uid": 0
}

TASK [k8s_cluster : Ensure kubernetes config directory exists] *************
task path: /work/roles/k8s_cluster/tasks/auth.yml:18
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/file.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353 `" && echo ansible-tmp-1531261687.43-91315504287353="` echo /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353 `" ) && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpa5UyJ0 TO /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353/file.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353/ /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353/file.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353/file.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261687.43-91315504287353/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "diff": {
        "after": {
            "path": "/root/.kube", 
            "state": "directory"
        }, 
        "before": {
            "path": "/root/.kube", 
            "state": "absent"
        }
    }, 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "delimiter": null, 
            "diff_peek": null, 
            "directory_mode": null, 
            "follow": true, 
            "force": false, 
            "group": null, 
            "mode": null, 
            "original_basename": null, 
            "owner": null, 
            "path": "/root/.kube", 
            "recurse": false, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "state": "directory", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "mode": "0755", 
    "owner": "root", 
    "path": "/root/.kube", 
    "size": 4096, 
    "state": "directory", 
    "uid": 0
}

TASK [k8s_cluster : Generate kubernetes client configuration] **************
task path: /work/roles/k8s_cluster/tasks/auth.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979 `" && echo ansible-tmp-1531261687.66-122329871464979="` echo /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/stat.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpZn7unt TO /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/stat.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/ /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/stat.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/stat.py && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmplPVzmk TO /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/source
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/ /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/source && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/copy.py
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmpnkqANj TO /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/copy.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/ /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/copy.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "checksum": "5497b7814ac8c31d437eb5a0ca26b02fdf838632", 
    "dest": "/root/.kube/config", 
    "diff": [], 
    "gid": 0, 
    "group": "root", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": false, 
            "checksum": "5497b7814ac8c31d437eb5a0ca26b02fdf838632", 
            "content": null, 
            "delimiter": null, 
            "dest": "/root/.kube/config", 
            "directory_mode": null, 
            "follow": false, 
            "force": true, 
            "group": null, 
            "local_follow": null, 
            "mode": null, 
            "original_basename": "tmplPVzmk", 
            "owner": null, 
            "regexp": null, 
            "remote_src": null, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/source", 
            "unsafe_writes": null, 
            "validate": null
        }
    }, 
    "md5sum": "15dda9e0e3766ae31062e2ca64591a91", 
    "mode": "0644", 
    "owner": "root", 
    "size": 1602, 
    "src": "/root/.ansible/tmp/ansible-tmp-1531261687.66-122329871464979/source", 
    "state": "file", 
    "uid": 0
}

TASK [k8s_cluster : Deploy the Traefik Daemonset] **************************
task path: /work/roles/k8s_cluster/tasks/main.yml:6
included: /work/roles/k8s_cluster/tasks/traefik.yml for localhost

TASK [k8s_cluster : Traefik Cluster Role] **********************************
task path: /work/roles/k8s_cluster/tasks/traefik.yml:3
Using module file /usr/lib/python2.7/site-packages/ansible/modules/clustering/k8s/k8s_raw.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553 `" && echo ansible-tmp-1531261688.19-37398652026553="` echo /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553 `" ) && sleep 0'
<localhost> PUT /root/.ansible/tmp/ansible-local-1azbLzk/tmppvk2jw TO /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553/k8s_raw.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553/ /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553/k8s_raw.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553/k8s_raw.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1531261688.19-37398652026553/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_VnpE5O/ansible_module_k8s_raw.py", line 163, in <module>
    main()
  File "/tmp/ansible_VnpE5O/ansible_module_k8s_raw.py", line 159, in main
    KubernetesRawModule().execute_module()
  File "/tmp/ansible_VnpE5O/ansible_modlib.zip/ansible/module_utils/k8s/raw.py", line 69, in __init__
  File "/tmp/ansible_VnpE5O/ansible_modlib.zip/ansible/module_utils/k8s/common.py", line 128, in get_helper
  File "/usr/lib/python2.7/site-packages/openshift/helper/base.py", line 52, in __init__
    self.set_client_config(**auth)
  File "/usr/lib/python2.7/site-packages/openshift/helper/base.py", line 115, in set_client_config
    self.api_client = self.client_from_config(config_file, context)
  File "/usr/lib/python2.7/site-packages/openshift/helper/kubernetes.py", line 19, in client_from_config
    return config.new_client_from_config(config_file, context)
  File "/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py", line 489, in new_client_from_config
    persist_config=persist_config)
  File "/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py", line 476, in load_kube_config
    loader.load_and_set(client_configuration)
  File "/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py", line 355, in load_and_set
    self._load_cluster_info()
  File "/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py", line 334, in _load_cluster_info
    file_base_path=self._config_base_path).as_file()
  File "/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py", line 100, in as_file
    base64.decodestring(self._data.encode()))
  File "/usr/lib/python2.7/base64.py", line 328, in decodestring
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_VnpE5O/ansible_module_k8s_raw.py\", line 163, in <module>\n    main()\n  File \"/tmp/ansible_VnpE5O/ansible_module_k8s_raw.py\", line 159, in main\n    KubernetesRawModule().execute_module()\n  File \"/tmp/ansible_VnpE5O/ansible_modlib.zip/ansible/module_utils/k8s/raw.py\", line 69, in __init__\n  File \"/tmp/ansible_VnpE5O/ansible_modlib.zip/ansible/module_utils/k8s/common.py\", line 128, in get_helper\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/base.py\", line 52, in __init__\n    self.set_client_config(**auth)\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/base.py\", line 115, in set_client_config\n    self.api_client = self.client_from_config(config_file, context)\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/kubernetes.py\", line 19, in client_from_config\n    return config.new_client_from_config(config_file, context)\n  File \"/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 489, in new_client_from_config\n    persist_config=persist_config)\n  File \"/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 476, in load_kube_config\n    loader.load_and_set(client_configuration)\n  File \"/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 355, in load_and_set\n    self._load_cluster_info()\n  File \"/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 334, in _load_cluster_info\n    file_base_path=self._config_base_path).as_file()\n  File \"/usr/lib/python2.7/site-packages/kubernetes/config/kube_config.py\", line 100, in as_file\n    base64.decodestring(self._data.encode()))\n  File \"/usr/lib/python2.7/base64.py\", line 328, in decodestring\n    return binascii.a2b_base64(s)\nbinascii.Error: Incorrect padding\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE", 
    "rc": 1
}
	to retry, use: --limit @/work/playbooks/k8s_virginia.retry

PLAY RECAP *********************************************************************
localhost                  : ok=7    changed=5    unreachable=0    failed=1   
@ansibot
Copy link
Contributor

ansibot commented Jul 11, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 11, 2018

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Jul 11, 2018
@willthames
Copy link
Contributor

Looks like an issue with your ~/.kube/config file - it seems to be trying to base64 decode something that is not properly base64 encoded.

Without your kube config it's impossible to debug further. This is happening at the kubernetes python module level, well below the k8s module.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jul 11, 2018
@Tzrlk
Copy link
Author

Tzrlk commented Jul 11, 2018

I was afraid of that. I suspect it's the certificate data that's at fault, since the rest of the file looks perfect. Thanks for the identification.

@Tzrlk Tzrlk closed this as completed Jul 11, 2018
@willthames
Copy link
Contributor

You could probably confirm this by doing echo $cert_data | base64 -D and seeing if it looks like a proper certificate (should start with a line like -----BEGIN CERTIFICATE----- and end with -----END CERTIFICATE----- - the key will be similar, as will the CA)

@dagwieers dagwieers added the k8s label Feb 8, 2019
@kvaps
Copy link
Contributor

kvaps commented Feb 18, 2019

I have this issue with OIDC-authorisation in python's kubernetes-client:
kubernetes-client/python-base#65

@ansible ansible locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. k8s module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

No branches or pull requests

5 participants