Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes.io/dockercfg type as docker secret for image_pull_secrets is not working #79

Closed
odedpriva opened this issue Oct 23, 2017 · 1 comment · Fixed by #165
Closed

Comments

@odedpriva
Copy link

odedpriva commented Oct 23, 2017

I set up a docker secret using :

resource "kubernetes_secret" "docker" {
  metadata {
    name = "docker-cfg"
  }

  data {
    ".dockercfg" = "${file("/Users/odedpriva/.docker/config.json")}"
  }

  type = "kubernetes.io/dockercfg"
}

trying to use it in pod resource returns an ErrImagePull error

resource "kubernetes_pod" "debug2" {
  count = "${var.services["debug"] ? 1 : 0}"

  metadata {
    name = "debug2"

    labels = {
      service = "debug"
    }
  }

  spec {
    image_pull_secrets = {
      name = "docker-cfg"
    }

    container {
      name  = "net-tools"
      image = "${var.debug["net-tools-image"]}:${var.debug["net-tools-tag"]}"
    }
  }
}

when creating this secret manually using k8s api

kubectl create secret docker-registry regsecret --docker-server=index.docker.io --docker-username=*** --docker-password=*** --docker-email=***@****

and referencing this secret in pod resource worked like a charm.

What am I doing wrong ?

local git:(master) ✗ ter version
Terraform v0.10.7
@philippeckel
Copy link

@radeksimko please try:
type = "kubernetes.io/dockerconfigjson"
instead of
type = "kubernetes.io/dockercfg"

Terraform's documentation seems to be wrong, but please have a look at Kubernetes' documentation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants