Bitnami memcached with metrics.enabled true is failing on kubernetes using terraform

3/4/2021

I am trying to install bitnami/memecached using https://artifacthub.io/packages/helm/bitnami/memcached/5.5.2 on K8S.

terraform version is : 0.12.18

My terraform files is as below.

resource "helm_release" "memcached" {
  chart = "memcached"
  name = "memcached"
  version = "5.5.2"
  timeout = 200
  repository = "https://charts.bitnami.com/bitnami"
  namespace = "default"
  
  set {
    name = "image.tag"
    value = "1.6.9-debian-10-r55"
  }

  set {
    name = "service.type"
    value = "ClusterIP"
  }
  set {
    name = "replicaCount"
    value = "1"
  }
}

But when I try to install it, I am getting following error.

Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: namespace: default, name: memcached-metrics, existing_kind: /v1, Kind=Service, new_kind: /v1, Kind=Service

-- Alpesh Jikadra
bitnami
devops
kubernetes
memcached
terraform

1 Answer

3/5/2021

It seems you are trying to install the Chart and it contains already existing resources in the Kubernetes cluster. Try deleting the service called memcached-metrics and then install it again. The chart was probably installed before with the same name and the service was not removed, so now it conflicts when trying to use the same name.

-- miguelaeh
Source: StackOverflow