knctl icon indicating copy to clipboard operation
knctl copied to clipboard

knctl deploy command fails when using image from AWS ECR registry

Open ajay-kumar-1 opened this issue 6 years ago • 4 comments

Hello All,

I had build an image of a sample application from github [https://github.com/cppforlife/simple-app] with knctl command.

Image is successfully build and I had stored this image of AWS ECR.

Now when I try to deploy the image on EKS cluster, it gets fails with below messages:

root@jenkins-5749546fc5-xq82z:/# knctl deploy --service deploy --image 631963551282.dkr.ecr.us-east-2.amazonaws.com/nginx:latest Name deploy Waiting for new revision to be created... Tagging new revision 'deploy-00001' as 'latest' Tagging new revision 'deploy-00001' as 'previous' Annotating new revision 'deploy-00001' Waiting for new revision 'deploy-00001' to be ready for up to 5m0s (logs below)... Revision 'deploy-00001' did not became ready ----->>>>> ISSUE Continuing to watch logs for 5s before exiting

Succeeded root@jenkins-5749546fc5-xq82z:/#

Can you help me on this?

ajay-kumar-1 avatar Mar 18 '19 09:03 ajay-kumar-1

@AjayKumar333 i would look at knctl service show -s deploy

cppforlife avatar Mar 18 '19 21:03 cppforlife

Hello,

Below is the required output:


root@jenkins-788f557b77-hdvhv:~# knctl service show -s deploy
Service 'deploy'

Name             deploy  
Domain           deploy.jx.example.com  
Internal Domain  deploy.jx.svc.cluster.local  
Annotations      -  
Age              6m  

Conditions

Type                 Status  Age  Reason           Message  
ConfigurationsReady  False   5m   RevisionFailed   Revision "deploy-00001" failed with message: "unsupported status code 401; body:  
                                                   Not Authorized\n".  
Ready                False   5m   RevisionMissing  Configuration "deploy" does not have any ready Revision.  
RoutesReady          False   5m   RevisionMissing  Configuration "deploy" does not have any ready Revision.  

Pods conditions

Pod  Type  Status  Age  Reason  Message  

Succeeded
root@jenkins-788f557b77-hdvhv:~#_ 

The above output is showing an error code 401 (Not authorized), for the authorization i am using a helper.sh script from the below link: https://github.com/knative/build-templates/tree/master/ecr_helper

This script do the following task:

  • serviceaccount created
  • secret "ecr-creds" created

ajay-kumar-1 avatar Mar 24 '19 09:03 ajay-kumar-1

Just for the information,

When I am using knctl command to delpoy from the public GIT repostory using below command:


knctl deploy --service deploy --git-url https://github.com/cppforlife/simple-app --git-revision master --service-account builder --image 631963551282.dkr.ecr.ap-northeast-2.amazonaws.com/test --env SIMPLE_MSG=123


The container image gets successfullly build and saved to ECR registory successfuly. However, the issue ( mentioned in 1st comments and in above logs) occur when it is going to deploy that image on kubernetes cluster.

Please help me.

ajay-kumar-1 avatar Mar 24 '19 09:03 ajay-kumar-1

@AjayKumar333 im not quite sure how knative + ecr_helper plays together. i would try out using knative directly and making that work with ecr. once you are sure it works, then trying to use knctl with it.

cppforlife avatar Mar 26 '19 21:03 cppforlife