Reactive cli 401 authentication error

Hi everyone,

I got error while deploying our microservices to our kubernetes cluster using

$ rp generate-kubernetes-resources 123456789000.dkr.ecr.eu-west-1.amazonaws.com/my-microservice-api-implementation:1.0-SNAPSHOT --generate-pod-controllers --generate-services --pod-controller-image-pull-policy Always --env JAVA_OPTS="-Dplay.http.secret.key=sample-secret-key -Dplay.filters.hosts.allowed.0=." --pod-controller-replicas 2 --external-service "cas_native=cassandra.default.svc.cluster.local" --external-service "kafka_native=ulterior-guppy-kafka-headless.default.svc.cluster.local" | kubectl apply -f -

It returns to me:

[error, com.lightbend.rp.reactivecli.Main$] Failed to obtain Docker config for 123456789000.dkr.ecr.eu-west-1.amazonaws.com/my-microservice-api-implementation:1.0-SNAPSHOT, unable to access repository or registry; check authentication [401]
Unable to connect to the server: dial tcp 192.168.99.100:8443: i/o timeout

We use amazon web services for private docker registries, is this error related about AWS ECR ?

How can we solve this problem?

Hi @saltik,

rp says you that it’s unable to login to your private docker registry.

Two options: Give it the informations necessary to make it logs in successfully or you could also use the rp --registry-use-local option

Jules

How can I give this necessary information, any example ?

--registry-use-local gives me Unable to connect to the server: dial tcp 192.168.99.100:8443: i/o timeout

rp decribes docker images with this format.

docker-images Docker images to be deployed. Format: [<registry host>/][<repo>/]image[:tag]

my registry is: 123456789000.dkr.ecr.eu-west-1.amazonaws.com/my-microservice-api-implementation:1.0-SNAPSHOT

I need to add repo before image, is this a format error ?

I tried with the updated private ragistry that has repo, but nothing changes.

Here’s what I do:

rp generate-kubernetes-resources "eu.gcr.io/myrepo-177524/dev/user-impl:latest" --generate-pod-controllers --generate-services --registry-use-local --pod-controller-replicas 3 --pod-controller-image-pull-policy Always > deploy/resources/myapp/user.yaml

I hope it could help you.

Hi guys,

Do you have working solution for this?

I am getting this error while i am trying to my docker images pushing to ibm cloud. My example rp command is like that:

rp generate-kubernetes-resources "$REGISTRY/$NAMESPACE/example-api-impl:1.0-SNAPSHOT" \
  --generate-pod-controllers --generate-services \
  --pod-controller-image-pull-policy Always \
  --env JAVA_OPTS="-Dplay.http.secret.key=$example_secret \
  -Dplay.filters.hosts.allowed.0=$allowed_host" \
  --external-service "cas_native=$cassandra_svc" \
  --external-service "kafka_native=$service_kafka" \
  --pod-controller-replicas 2 | kubectl apply -f -

Error:

[error, com.lightbend.rp.reactivecli.docker.DockerRegistry$] Unable to obtain an OAuth token (401 {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"ibm/example-api-impl","Action":"pull"}]}]}
)
[error, com.lightbend.rp.reactivecli.Main$] Failed to obtain Docker config for registry.eu-de.bluemix.net/ibm/example-api-impl:1.0-SNAPSHOT, unable to access repository or registry; check authentication [401]

My rp version:

rp (Reactive CLI) 1.2.0
jq support: Available

This was a bug and solved in reactive-cli 1.3.2