Puppet kubernetes module

4/12/2018

I installed the puppet kubernetes module to manage pods of my kubernetes cluster with https://github.com/garethr/garethr-kubernetes/blob/master/README.md

I am not able to get any pod information back when I run

puppet resource kubernetes_pod

It just returns an empty line.

I am using a minikube k8s cluster to test the puppet module against.

cat /etc/puppetlabs/puppet/kubernetes.conf

apiVersion: v1 clusters: - cluster: certificate-authority: /root/.minikube/ca.crt server: https://<ip address>:8443 name: minikube contexts: - context: cluster: minikube user: minikube name: minikube current-context: minikube kind: Config preferences: {} users: - name: minikube user: client-certificate: /root/.minikube/apiserver.crt client-key: /root/.minikube/apiserver.key

I am able to use curl with the certs to talk to the K8s REST API

curl --cacert /root/.minikube/ca.crt --cert /root/.minikube/apiserver.crt --key /root/.minikube/apiserver.key https://<minikube ip>:844/api/v1/pods/

-- Mike
kubernetes
puppet

2 Answers

4/12/2018

From the requirements, this could be related to a credentials issue.
Or the configuration is set to a namespace with nothing in it.

As show in this issue, check the following:

kubectl get pods works fine at the command line, and my ~/.puppetlabs/etc/puppet/kubernetes.conf file is generated as suggested:

mc0e@xxx:~$ kubectl config view --raw=true
apiVersion: v1
clusters:
- cluster:
server: http://localhost:8080
  name: test-doc
contexts:
- context:
cluster: test-doc
user: ""
  name: test-doc
current-context: test-doc
kind: Config
preferences: {}
users: []
-- VonC
Source: StackOverflow

4/12/2018

It looks like the garethr-kubernetes package hasn't been updated since August 2017, so you probably need a version of the kubeclient gem at least that old. It seems kubeclient 3.0 came out quite recently, so you might want to try the latest version from the 2.5 major (currently 2.5.2).

-- fgsfds
Source: StackOverflow