GKE not able to pull image from artifactory

4/16/2019

I am using GKE, gitlab and JFrog to achieve CI and CD. All my steps work, but my deployment to GKE fails as its not able to poll my image. Image does exists. I have given below deployment, yaml and error message.

Below is my deployment file, i have hardcoded the image to be clear that image does exists.

--- 
apiVersion: extensions/v1beta1
kind: Deployment
metadata: 
  labels: 
    app: go
  name: hello-world-go
spec: 
  progressDeadlineSeconds: 600
  replicas: 3
  selector: 
    matchLabels: 
      app: go
  strategy: 
    rollingUpdate: 
      maxSurge: 1
      maxUnavailable: 33%
    type: RollingUpdate
  template: 
    metadata: 
      labels: 
        app: go
    spec: 
      containers: 
        - 
         # image: "<IMAGE_NAME>"
          image: cicd-docker-local.jfrog.io/stage_proj:56914646
          livenessProbe: 
            httpGet: 
              path: /healthz
              port: 8080
            initialDelaySeconds: 2
            periodSeconds: 2
          name: go
          ports: 
            - 
              containerPort: 8080
          readinessProbe: 
            httpGet: 
              path: /healthz
              port: 8080
            initialDelaySeconds: 2
            periodSeconds: 2
      imagePullSecrets:
        - name: my.secret        

Below is my gitlab yaml file snippet

deploy to dev:
  stage: Dev-Deploy
  image: dtzar/helm-kubectl
  script:
    - kubectl config set-cluster mycluster --server="$KUBE_URL" --insecure-skip-tls-verify=true
    - kubectl config set-credentials admin --username="$KUBE_USER" --password="$KUBE_PASSWORD"
    - kubectl config set-context default --cluster=mycluster --user=admin
    - kubectl config use-context default; sleep 10
    - kubectl delete secret my.secret
    - kubectl create secret docker-registry  my.secret --docker-server=$ARTIFACTORY_DOCKER_REPOSITORY --docker-username=$ARTIFACTORY_USER --docker-password=$ARTIFACTORY_PASS --docker-email="abc@gmail.com"
    - echo ${STAGE_CONTAINER_IMAGE}
    - kubectl apply -f deployment.yaml
    - kubectl rollout status -w "deployment/hello-world-go"
   # - kubectl rollout status -f deployment.yaml
    - kubectl get all,ing -l app='hello-world-go'
  only:
    - master

I get error like below in GKE.

Cannot pull image 'cicd-docker-local.jfrog.io/stage_proj:56914646' from the registry.
-- Hacker
gitlab
google-kubernetes-engine
jfrog-cli

0 Answers