spinnaker /halyard : Unable to communicate with the Kubernetes cluster

Viewed 1968

I am trying to deploy spinnaker on multi node . I have 2 VMs : the first with halyard and kubectl the second contain the kubernetes master api. my kubectl is well configured and able to communicate with the remote kubernetes api,

the "kubectl get namespaces " works

kubectl get namespaces
NAME          STATUS    AGE
default       Active    16d
kube-public   Active    16d
kube-system   Active    16d

but when I run this cmd

hal config provider -d kubernetes account add spin-kubernetes --docker-registries myregistry 
 I get this error
 Add the spin-kubernetes account
  Failure
Problems in default.provider.kubernetes.spin-kubernetes:
- WARNING You have not specified a Kubernetes context in your
  halconfig, Spinnaker will use "default-system" instead.
? We recommend explicitly setting a context in your halconfig, to
  ensure changes to your kubeconfig won't break your deployment.
? Options include:
  - default-system

! ERROR Unable to communicate with your Kubernetes cluster:
  Operation: [list]  for kind: [Namespace]  with name: [null]  in namespace:
  [null]  failed..
? Unable to authenticate with your Kubernetes cluster. Try using
  kubectl to verify your credentials.

- Failed to add account spin-kubernetes for provider
  kubernetes.
2 Answers

You can set this in your halconfig as mentioned by @Naim Salameh.

Another way is to try setting your K8S cluster info in your default Kubernetes config ~/.kube/config.

Not certain this will work since you are running halyard and kubectl on different VM's.

# ~/.kube/config
apiVersion: v1
clusters:
- cluster:
    server: http://my-kubernetes-url
  name: my-k8s-cluster
contexts:
- context:
    cluster: my-k8s-cluster
    namespace: default
  name: my-context
current-context: my-context
kind: Config
preferences: {}
users: []
Related