Unable to recognize deployment.yaml

hi! im try to serve react website from google cloud.Firstly i made it manually but when i try to deploy it gives an “error: unable to recognize “k8s/deployment.yaml”: Get http://localhost:8080/api?timeout=32s: dial tcp [::1]:8080: connect: connection refused”

This is my gitlab-ci.yaml file

stages:
- package
- deploy2dev

package:
stage: package
image: docker:latest
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
- docker build -t registry.gitlab.com/uftunca72/timer-test .
- docker tag registry.gitlab.com/uftunca72/timer-test:latest registry.gitlab.com/uftunca72/timer-test:$CI_PIPELINE_ID
- docker push registry.gitlab.com/uftunca72/timer-test:latest
- docker push registry.gitlab.com/uftunca72/timer-test:$CI_PIPELINE_ID

deploy2dev:
stage: deploy2dev
image: google/cloud-sdk:alpine
before_script:
- gcloud auth activate-service-account --key-file k8s/evenally.json
- gcloud components install kubectl
script:
- kubectl apply -f k8s/deployment.yaml
- gcloud container clusters get-credentials timerex
- kubectl expose deployment timerfixv2 --type LoadBalancer --port 80 --target-port 5000

Had the same issue. Have a look at your target address (url) of k8s cluster.

Mine address variable was unreachable due to CI variable in protected mode.

  • kubectl config set-cluster k8s --server=“$KUBE_URL”

with optional (–insecure-skip-tls-verify=true) if you face TLS errors

1 Like