[英]Gitlab-agent with Helm: Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp [::1]:8080: connect: connection refused
i installed the new gitlab agent for kubernetes cluster.我为 kubernetes 集群安装了新的 gitlab 代理。 This works when I use KUBECTL and gives this error when I try to deploy in Azure Cloud with Helm chart.这在我使用 KUBECTL 时有效,当我尝试使用 Helm 图表在 Azure Cloud 中部署时出现此错误。
my.gitlab-ci.yml我的.gitlab-ci.yml
variables: #registry variable REGISTRY: registry.gitlab.com #docker-image tag DOCKER_IMAGE_TAG: ${CI_COMMIT_SHA} #target variable TARGET: metrix9/wysiwys-ic stages: - build - package - deploy #job to build gradle application and save the jar file in artifacts build docker image: image: gradle stage: build before_script: - chmod +x./gradlew script: -./gradlew jib -Djib.to.auth.username=$CI_REGISTRY_USER -Djib.to.auth.password=$CI_REGISTRY_PASSWORD -Djib.from.auth.username=$CI_REGISTRY_USER -Djib.from.auth.password=$CI_REGISTRY_PASSWORD # job to push file-server docker-imagedocker package wysiwys image: stage: package image: docker.io/library/docker #dependencies: # - build services: - name: docker:dind before_script: - IMAGE=${CI_REGISTRY}/${TARGET} - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker pull "${IMAGE}:latest" || true script: #- docker build --tag "${IMAGE}:latest". - docker push "${IMAGE}:latest" #job to package and push the file-server helm chart package wysiwys-ic helm: stage: package image: name: alpine/helm entrypoint: [""] before_script: - helm repo add --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD wysiwys-ci-repo https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/helm/stable - helm plugin install https://github.com/chartmuseum/helm-push script: - helm package wysiwys-helm - helm cm-push./wysiwys-helm-0.1.0.tgz wysiwys-ci-repo #job to install convert2pdf with helm chart install wysiwys-ic: stage: deploy image: name: alpine/helm entrypoint: [""] before_script: - helm repo add bitnami https://charts.bitnami.com/bitnami -n Convert2pdf-repo script: - helm upgrade --install wysiwys-ci./wysiwys-helm
i tryed export the KUBECONFIG and to run helm repo update in the pipeline.. but the same error comes out...我尝试导出 KUBECONFIG 并在管道中运行 helm repo update ..但是出现了同样的错误......
I was struggling with the same issue.我正在为同样的问题而苦苦挣扎。 First use image with helm and kubectl(fe registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications) and try adding the following changes in the deployment part:首先使用带有 helm 和 kubectl 的图像(fe registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications)并尝试在部署部分添加以下更改:
deploy app:
stage: deploy-app
variables:
KUBE_CONTEXT: -->gitlabproject<--:-->name of the installed agent<--
before_script:
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.