spinnaker /halyard : Unable to communicate with the Kubernetes cluster

7/4/2017

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.
-- Anihak
kubectl
kubernetes
spinnaker

2 Answers

7/5/2017

From the error message there seem to be two approaches to this, set your halconfig to talk to the default-system context, so it could communicate with your cluster or the other way around, that is configure your context.

Try this:

kubectl config view

I suppose you'll see the context and current context over there to be default-system, try changing those. For more help do

kubectl config --help

I guess you're looking for the set-context option. Hope that helps.

-- Naim Salameh
Source: StackOverflow

11/12/2017

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: []
-- grizzthedj
Source: StackOverflow