3

I have a Kubernetes cluster which is running in a private cloud. I want to run some commands from another VM but I receive this:

[root@runner-tmp ~]# kubectl get pods --kubeconfig local-cluster.yaml
error: tls: failed to find any PEM data in certificate input

My local-cluster.yaml:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://x.x.x.x:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    namespace: FSM
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

Do you have any idea where should I specify this PEM certificate and how can I generate it?

1 Answers1

1

Message error: tls: failed to find any PEM data in certificate input appears when you copy output of kubectl config view to remote VM.

So instead of copying output of kubectl config view to your remote VM you should provide entire config file that is usually present in $HOME/.kube/config.

You can do it by running scp root@<control-plane-host>:/etc/kubernetes/admin.conf . and then providing this file as --kubeconfig, for example:

kubectl --kubeconfig ./admin.conf get nodes
TheFrost
  • 103
  • 2
kool
  • 190