failed to dial all known cluster members, (http://storageos.kube-system.svc.cluster.local)
I'm trying to connect a in-cluster client to the StorageOS API but cluster members cannot be found.
This is my go code
func InitClient() error {
cli, err := storageos.NewClient(env.Get(env.STORAGEOS_HOST))
if err != nil {
return err
}
cli.SetAuth(env.Get(env.STORAGEOS_USERNAME), env.Get(env.STORAGEOS_PASSWORD))
client = cli
return nil
}
and then I run a test ping
if err = client.Ping(); err != nil {
log.Error(err, "Failed ping test StorageOS API")
os.Exit(1)
}
and there is the error
"error":"failed to dial all known cluster members, (http://storageos.kube-system.svc.cluster.local)
The pod is running in another namespace.
This is the storageos service:
apiVersion: v1
kind: Service
metadata:
labels:
app: storageos
name: storageos
namespace: kube-system
spec:
clusterIP: 10.43.68.167
ports:
- name: storageos
port: 5705
protocol: TCP
targetPort: 5705
selector:
app: storageos
kind: daemonset
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
Hi @robinbraemer, can you try appending the port (:5705) to STORAGEOS_HOST? Just had a quick look at the api code and it only seems to set the default port if you've not set STORAGEOS_HOST at all, otherwise it expects the port to be set.
If that doesn't work you could try to isolate by running the CLI in the same namespace, and see if that can connect? There's a script to do that here: https://github.com/storageos/deploy/blob/master/k8s/run-cli.sh. You'll need to change the env vars to match the credentials and the service.