Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes deployment.extensions not found

I get the following error message in my Gitlab CI pipeline and I can't do anything with it. Yesterday the pipeline still worked, but I didn't change anything in the yml and I don't know where I made the mistake. I also reset my code to the last working commit, but the error still occurs.

$ kubectl set image deployment/ft-backend ft-backend=registry.gitlab.com/projectX/ft-backend

Error from server (NotFound): deployments.extensions "ft-backend" not found

.gitlab-ci.yml

image: docker:latest
services:
  - docker:dind

variables:
  DOCKER_DRIVER: overlay
  SPRING_PROFILES_ACTIVE: gitlab-ci

stages:
  - build
  - package
  - deploy

maven-build:
  image: maven:3-jdk-8
  stage: build
  script: "mvn package -B"
  artifacts:
    paths:
      - target/*.jar

docker-build:
  stage: package
  script:
  - docker build -t registry.gitlab.com/projectX/ft-backend:${CI_COMMIT_SHA} .
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
  - docker push registry.gitlab.com/projectX/ft-backend:${CI_COMMIT_SHA}

k8s-deploy:
  image: google/cloud-sdk
  stage: deploy
  script:
  - echo "$GOOGLE_KEY" > key.json
  - gcloud auth activate-service-account --key-file key.json
  - gcloud config set compute/zone europe-west3-a
  - gcloud config set project projectX
  - gcloud config unset container/use_client_certificate
  - gcloud container clusters get-credentials development --zone europe-west3-a --project projectX
  - kubectl delete secret registry.gitlab.com
  - kubectl create secret docker-registry registry.gitlab.com --docker-server=https://registry.gitlab.com --docker-username=MY_NAME --docker-password=$REGISTRY_PASSWD --docker-email=MY_MAIL
  - kubectl set image deployment/ft-backend ft-backend=registry.gitlab.com/projectX/ft-backend:${CI_COMMIT_SHA}
  - kubectl apply -f deployment.yml
like image 981
laprof Avatar asked Dec 03 '18 22:12

laprof


2 Answers

I suppose that when you are invoking command:

kubectl set image deployment/ft-backend ft-backend=registry.gitlab.com/projectX/ft-backend

deployment ft-backend does not exist in your cluster. Does the command: kubectl get deployment ft-backend return the same result?

like image 198
Nick_Kh Avatar answered Oct 05 '22 17:10

Nick_Kh


Use this command to create deployments, its not supported in newer version: check this for newer version:

$ kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
like image 22
Chandrabhan Shukla Avatar answered Oct 05 '22 17:10

Chandrabhan Shukla