error: arguments in resource/name form may not have more than one slash (kubernetes)

10/23/2019

gitlab-ci.yml

stages:
  - build
  - docker-push
  - deploy

cache:
  paths:
    - node_modules/

build:
  stage: build
  image: node:latest
  script:
    - yarn install
    - npm run build
  artifacts:
    paths:
      - dist/
  only:
    - master

docker:
  stage: docker-push
  image: docker:18.09.7

  services:
    - docker:18.09.7-dind
    - google/cloud-sdk:latest

  script:
    - echo $GCP_ACCESS_JSON > $CI_PIPELINE_ID.json
    - cat $CI_PIPELINE_ID.json | docker login -u _json_key --password-stdin $GCP_REGION
    - docker build -t gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest .
    - docker push gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

  only:
    - master

test:
  stage: deploy
  image: google/cloud-sdk:latest
  script:
    - echo $GCP_ACCESS_JSON > $CI_PIPELINE_ID.json
    - gcloud auth activate-service-account $GCP_CE_PROJECT_EMAIL --key-file $CI_PIPELINE_ID.json --project $GCP_PROJECT_ID
    - gcloud container clusters get-credentials $CLUSTER_NAME --zone $ZONE --project $PROJECT_NAME
    - kubectl set image deployment/$CLUSTER_NAME gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

  only:
    - master

I want to deploy my project to the Kubernetes cluster. I've created this cluster manually by using Kubernetes Engine in GCP. Then as you can see in my gitlab-ci.yml file I move my docker image to gcp Container Registry and then I want to deploy it by using command:

- kubectl set image deployment/$CLUSTER_NAME gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

But here I get error :

enter image description here

What do I do wrong ? I've used this link as a tutorial (https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app) . If you need additional info , pls let me know !

-- Andrey Radkevich
gitlab-ci
kubernetes

1 Answer

10/23/2019
- kubectl set image deployment/$CLUSTER_NAME $INSTANSE_NAME=gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

It is working with using command like this

-- Andrey Radkevich
Source: StackOverflow