Spinnaker / halyard: Unable to contact Kubernetes cluster
I am trying to deploy a spinnaker to a multi node. I have 2 virtual machines: the first one with a file and a cuvect, the second one contains Kubernetes master api. my kubectl is well configured and able to communicate with remote kubernetes api,
"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.
source to share
From the error message there seems to be two approaches to this, set halconfig to talk to the default system context so that it can interact with your cluster or some other way that configures your context.
Try the following:
kubectl config view
I assume the context and current context will be used by default there, try changing them. For more help run
kubectl config --help
I think you are looking for the set-context option. Hope it helps.
source to share
You can set this in your halconfig as @Naim Salameh pointed out.
Another way is to try to configure your K8S cluster information to the default Kubernetes configuration ~/.kube/config
.
I'm not sure it would work, since you are using halyard
and kubectl
for different virtual machines.
# ~/.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: []
source to share