Hi everyone, I am currently interested in deploying our applications to kubernetes. Now I have in gitlb deployment solved via docker compose, which is not a very happy solution. I would therefore wish to deploy to the kubernetes cluster. I currently have two kubernetes clusters for testing and I’m trying to deploy them from gitlab CI. The whole pipeline runs fine, but as soon as it is deployed in kubernetes it crashes. I followed the instructions Automated Kubernetes deployments with GitLab, Helm and Traefik | by Yanick Witschi | Medium where I used the deployment method through the helmet chart because it looked best. My goal was to deploy both DB and tomcat, but unfortunately I got stuck with tomcat. When running the build from the manual via gitla-ci.yml it crashes, see below. I’m new to this. Has anyone solved such a problem yet? or do you not have an example of gitlab-ci.yml for tomcat with psql? Below I enclose the current gitlab-ci.yml
stages:
- compile
- build
- deploy
variables:
IMAGE: ${CI_REGISTRY_IMAGE}/argos-control-test:${CI_COMMIT_REF_SLUG}
URL_REVIEW: ${CI_COMMIT_REF_SLUG}.my-app.cloud
URL_PRODUCTION: live.my-app.cloud
.maven:
image: maven:3.6.3-openjdk-8
variables:
cache:
key: maven-repository
paths:
- .m2/repository
compile:
extends: .maven
stage: compile
script:
- mvn clean install
- mv -v target/my-app.war my-app.war
artifacts:
paths:
- my-app.war
expire_in: 10 min
build:
extends: .maven
stage: build
image: docker:18.09.7-dind
services:
- docker:18.09.7-dind
variables:
DOCKER_DRIVER: overlay
DOCKER_HOST: tcp://localhost:2375
artifacts:
paths:
- my-app.war
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login --username "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
deploy_review:
stage: deploy
image: devth/helm
script:
- mkdir -p /etc/deploy
- helm upgrade
--install
--set web.name="my-app-${CI_COMMIT_REF_SLUG}"
--set web.image="${IMAGE}"
--set web.host="${URL_REVIEW}"
--wait
--force
my-app-${CI_COMMIT_REF_SLUG}
./k8s-chart
except:
refs:
- master
deploy_production:
stage: deploy
image: devth/helm
script:
- mkdir -p /etc/deploy
- helm upgrade
--install
--set web.name="my-app-${CI_COMMIT_REF_SLUG}"
--set web.image="${IMAGE}"
--set web.host="${URL_PRODUCTION}"
--wait
--force
my-app-${CI_COMMIT_REF_SLUG}
./k8s-chart
only:
refs:
- master
and with deploy_production it crashes
Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
Thank you very much in advance for any advice, ideas or help