Rundeck - Kubernetes / Job / Create returns error: AttributeError: 'function' object has no attribute 'set_default'

980 views
Skip to first unread message

Francis McGregor-Macdonald

unread,
May 16, 2018, 11:46:18 AM5/16/18
to rundeck-discuss
I am getting the below error attempting to run a Kubernetes / Job / Create. Has anyone else seen this error or does anyone have a possible remedy?

[Kubernetes-Create-Job] executing: [python, -u, /var/lib/rundeck/libext/cache/kubernetes-plugin-1.0.4/job-create.py]
21:00:33DEBUG: kubernetes-model-source: Log level configured for DEBUG
21:00:33Traceback (most recent call last):
21:00:33 File "/var/lib/rundeck/libext/cache/kubernetes-plugin-1.0.4/job-create.py", line 208, in <module>
21:00:33 main()
21:00:33 File "/var/lib/rundeck/libext/cache/kubernetes-plugin-1.0.4/job-create.py", line 132, in main
21:00:33 common.connect()
21:00:33 File "/var/lib/rundeck/libext/cache/kubernetes-plugin-1.0.4/common.py", line 60, in connect
21:00:33 client.Configuration.set_default(configuration)
21:00:33AttributeError: 'function' object has no attribute 'set_default'
21:00:34[Kubernetes-Create-Job]: result code: 1
21:00:34Failed: NonZeroResultCode: Script result code was: 1

edu...@rundeck.com

unread,
May 16, 2018, 1:50:26 PM5/16/18
to rundeck-discuss
Hi Francis,

From the error log, it may be possible that you are facing a bug related to the authentication/connection of the Kubernetes plugin. Would you mind sharing your project's configuration in order to confirm this?

Thank you and Best Regards.

Eduardo Carrasco

Francis McGregor-Macdonald

unread,
May 16, 2018, 4:45:31 PM5/16/18
to rundeck-discuss
Hi Eduardo,

Thank you for looking at this. Is the below what you are looking for?

#Thu May 17 08:42:53 NZST 2018
#edit below
project.description=Home project
project.disable.executions=false
project.disable.schedule=false
project.gui.readme.display=projectHome
project.jobs.gui.groupExpandLevel=1
project.label=
project.nodeCache.enabled=false
project.plugin.NodeExecutor.Kubernetes-node-executor.config_file=/var/lib/rundeck/.kube/config
project.plugin.NodeExecutor.Kubernetes-node-executor.shell=/bin/bash
project.plugin.NodeExecutor.Kubernetes-node-executor.token=keys/k8s/rundeck-token-nwkmp
project.plugin.NodeExecutor.Kubernetes-node-executor.url=k8s.mycluster.com
project.ssh-authentication=privateKey
project.ssh-command-timeout=0
project.ssh-connect-timeout=0
project.ssh-key-storage-path=keys/ec2/xavier
project.ssh-keypath=/var/lib/ec2-user/.ssh/id_rsa
resources.source.1.config.file=/var/rundeck/projects/Main/etc/resources.xml
resources.source.1.config.format=resourcexml
resources.source.1.config.generateFileAutomatically=true
resources.source.1.config.includeServerNode=true
resources.source.1.config.requireFileExists=false
resources.source.1.config.writeable=false
resources.source.1.type=file
resources.source.2.config.assumeRoleArn=arn\:aws\:iam\:\:756470474203\:role/rundeck
resources.source.2.config.endpoint=ec2.ap-southeast-2.amazonaws.com
resources.source.2.config.httpProxyPort=80
resources.source.2.config.refreshInterval=30
resources.source.2.config.runningOnly=false
resources.source.2.config.synchronousLoad=true
resources.source.2.config.useDefaultMapping=true
resources.source.2.type=aws-ec2
service.FileCopier.default.provider=jsch-scp
service.NodeExecutor.default.provider=Kubernetes-node-executor

Regards,
Francis

edu...@rundeck.com

unread,
May 16, 2018, 5:09:59 PM5/16/18
to rundeck-discuss

Thank you, Francis,

Exactly what we needed. I'll get back to you shortly with more feedback.

Thanks!

Eduardo Carrasco

edu...@rundeck.com

unread,
May 16, 2018, 5:44:28 PM5/16/18
to rundeck-discuss
Francis,

Can you please also send the affected Job's definitions as well? I completely overlook to ask you for those too in my previous post.

Thanks!

Eduardo Carrasco

Francis McGregor-Macdonald

unread,
May 16, 2018, 6:20:44 PM5/16/18
to rundeck...@googlegroups.com
Hi Eduardo,

The job yaml:
- defaultTab: summary
  description: |-
    GitHub: Link to git
  executionEnabled: true
  group: AGroup
  id: 63807d34-4bb5-47bb-af01-524dc4a9b393
  loglevel: INFO
  name: my | export
  nodeFilterEditable: false
  options:
  - name: CONFIG_PATH
    required: true
    value: s3://pathtofile.yaml
  scheduleEnabled: true
  sequence:
    commands:
    - configuration:
        api_version: batch/v1
        container_image: 1234.mycontainer
        container_name: my-data-export
        debug: 'true'
        environments: CONFIG_PATH=${option.CONFIG_PATH}
        image_pull_policy: Always
        name: my-data-export-service
        namespace: default
        token: keys/k8s/rundeck-token-nwkmp
        url: k8s.mycluster.com
        verify_ssl: 'false'
      nodeStep: true
      type: Kubernetes-Create-Job
    keepgoing: true
    strategy: node-first
  timeZone: GMT+12:00
  uuid: sadfasdf-sdafsadf-47bb-af01-524dc4a9b393

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/te3VSfyn2MU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To post to this group, send email to rundeck...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/f6dbc153-dabb-4ba5-b62b-b17df628cd0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jean Baptiste Guerraz

unread,
May 17, 2018, 2:02:10 AM5/17/18
to rundeck...@googlegroups.com
Hello,


It's a java implementation which so save the (memory) cost of forking a python process. OTOH it supports only kubernetes jobs.

Have a great (rundeck) day :-)

Jean-Baptiste

You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.

To post to this group, send email to rundeck...@googlegroups.com.

Francis McGregor-Macdonald

unread,
May 22, 2018, 8:29:13 PM5/22/18
to rundeck-discuss
Thanks Jean-Baptiste,

That doesn't seem to work either which leads me to believe that Rundeck can't "see" the cluster. I can connect to the cluster both with kubectl run from within Rundeck "command" and using the same python env as Rundeck is using from on the Rundeck VM.

Is there an obvious setting I am missing here? Is there a way to debug the connection?

Thanks

Jean Baptiste Guerraz

unread,
May 23, 2018, 4:06:28 AM5/23/18
to rundeck...@googlegroups.com
Hello Francis,

If you get it working with "command" step plugin then it probably
means you connect to a remote machine which have access to the
cluster.
If that cluster is exposed (the kube-apiserver process bind an address
you can reach from the rundeck machine) you should set the "kubernetes
URL" field accordingly and the "kubernetes token" one as well so the
plugin can talk to your cluster and then create the job.

Once you know what ip address your kube-apiserver is supposed to be
reachable thru, then you can use a simple curl to ensure it's actually
reachable, like :

$ curl -k https://the.kubeapi.ip.addr
{
"kind": "Status",
"apiVersion": "v1",
....

If you dunno what ip the apiserver bind, you can try something like :

kubectl -n kube-system describe pod kube-apiserver | grep IP

Hope it helps!

Have fun with k8s & rundeck.

Jean-Baptsite
> https://groups.google.com/d/msgid/rundeck-discuss/69670e83-92cc-4fc3-b415-4bfc95779070%40googlegroups.com.

edu...@rundeck.com

unread,
Jun 15, 2018, 12:19:52 PM6/15/18
to rundeck-discuss
Hi Francis,

Testing your project configuration and job definitions we were unable to reproduce the error. Would you mind sharing the Python and Kubernetes SDK versions used?

Thanks!

Francis McGregor-Macdonald

unread,
Jun 15, 2018, 7:14:59 PM6/15/18
to rundeck...@googlegroups.com
Hi Eduardo,

Well the checking ... solved the issue.

The install sequence was approximately ...
Create EC2 instance (which already has python installed)
Install Conda  as the preferred distribution
Install python-kubernetes with "pip install kubernetes"

Pip appeared to have installed correctly into the conda env as when I manually started python I could use the client and see I was using the conda dist.

I had the rundeck >> kubernetes issues.

When you just asked the question I went back and checked the conda install for python-kubernetes  which is "conda install -c conda-forge python-kubernetes"

This did install suggesting that conda hadn't correctly applied the pip install. I would say the pip went to the incorrect env but when I manually ran python I could use kubernetes within conda.

After running  conda install -c conda-forge python-kubernetes I can now connect my the kubernetes cluster.

So problem solved for me, I am not sure its worth additional effort to investigate or better to close as I am happy to consider this my install error.

Regards,
Francis


--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/te3VSfyn2MU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To post to this group, send email to rundeck...@googlegroups.com.

edu...@rundeck.com

unread,
Jun 18, 2018, 12:10:40 PM6/18/18
to rundeck-discuss
Hi Francis,

Great news! I'm glad that you can manage to move forward with that plugin.

Best Regards
Reply all
Reply to author
Forward
0 new messages