Skip to content

Cannot create cluster with container_runtime other than docker #225

@sebastian-de

Description

@sebastian-de

Hi,

thanks for creating the minikube provider, this is really helpful for testing!

I encountered a problem: I can successfully create clusters when using the Docker runtime, but when I want to use a different runtime, I always get this error:

│ Error: Failed to start host: creating host: create: Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.50.165:2376": dial tcp 192.168.50.165:2376: connect: connection refused
│ You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
│ Be advised that this will trigger a Docker daemon restart which might stop running containers.

I used the following example (using containerd results in the same error):

terraform {
  required_providers {
    minikube = {
      source  = "scott-the-programmer/minikube"
      version = "0.6.0"
    }
  }
}

provider minikube {
  kubernetes_version = "v1.34.0"
}

resource "minikube_cluster" "cluster" {
  driver            = "kvm2"
  cni               = "bridge"
  container_runtime = "cri-o"
}

Creating this example manually, using minikube start --driver=kvm2 --container-runtime cri-o --kubernetes-version v1.34.0 --cni bridge works fine.

I'm using Arch Linux with OpenTofu v1.11.2.

full log

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated
with the following symbols:
  + create

OpenTofu will perform the following actions:

  # minikube_cluster.cluster will be created
  + resource "minikube_cluster" "cluster" {
      + apiserver_name             = "minikubeCA"
      + apiserver_names            = (known after apply)
      + apiserver_port             = 8443
      + auto_pause_interval        = 1
      + auto_update_drivers        = true
      + base_image                 = "gcr.io/k8s-minikube/kicbase:v0.0.48@sha256:7171c97a51623558720f8e5878e4f4637da093e2f2ed589997bedc6c1549b2b1"
      + cache_images               = true
      + cert_expiration            = 1576800
      + client_certificate         = (sensitive value)
      + client_key                 = (sensitive value)
      + cluster_ca_certificate     = (sensitive value)
      + cluster_name               = "terraform-provider-minikube"
      + cni                        = "bridge"
      + container_runtime          = "cri-o"
      + cpus                       = "2"
      + delete_on_failure          = false
      + disable_coredns_log        = false
      + disable_driver_mounts      = false
      + disable_metrics            = false
      + disable_optimizations      = false
      + disk_size                  = "20000mb"
      + dns_domain                 = "cluster.local"
      + dns_proxy                  = false
      + download_only              = false
      + driver                     = "kvm2"
      + dry_run                    = false
      + embed_certs                = false
      + extra_disks                = 0
      + force                      = false
      + force_systemd              = false
      + ha                         = false
      + host                       = (known after apply)
      + host_dns_resolver          = true
      + host_only_cidr             = "192.168.59.1/24"
      + host_only_nic_type         = "virtio"
      + hyperkit_vsock_ports       = (known after apply)
      + hyperv_use_external_switch = false
      + id                         = (known after apply)
      + insecure_registry          = (known after apply)
      + install_addons             = true
      + interactive                = true
      + iso_url                    = (known after apply)
      + keep_context               = false
      + kvm_gpu                    = false
      + kvm_hidden                 = false
      + kvm_network                = "default"
      + kvm_numa_count             = 1
      + kvm_qemu_uri               = "qemu:///system"
      + memory                     = "4096mb"
      + mount                      = false
      + mount_9p_version           = "9p2000.L"
      + mount_gid                  = "docker"
      + mount_msize                = 262144
      + mount_port                 = 0
      + mount_string               = "/home:/minikube-host"
      + mount_type                 = "9p"
      + mount_uid                  = "docker"
      + namespace                  = "default"
      + nat_nic_type               = "virtio"
      + native_ssh                 = true
      + nfs_share                  = (known after apply)
      + nfs_shares_root            = "/nfsshares"
      + no_kubernetes              = false
      + no_vtx_check               = false
      + nodes                      = 1
      + output                     = "text"
      + ports                      = (known after apply)
      + preload                    = true
      + registry_mirror            = (known after apply)
      + service_cluster_ip_range   = "10.96.0.0/12"
      + socket_vmnet_client_path   = "/usr/local/opt/socket_vmnet/bin/socket_vmnet_client"
      + socket_vmnet_path          = "/usr/local/var/run/socket_vmnet"
      + ssh_port                   = 22
      + ssh_user                   = "root"
      + vm                         = false
      + wait_timeout               = 6
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

minikube_cluster.cluster: Creating...
minikube_cluster.cluster: Still creating... [10s elapsed]
minikube_cluster.cluster: Still creating... [20s elapsed]
minikube_cluster.cluster: Still creating... [30s elapsed]
minikube_cluster.cluster: Still creating... [40s elapsed]
minikube_cluster.cluster: Still creating... [50s elapsed]
╷
│ Error: Failed to start host: creating host: create: Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.50.165:2376": dial tcp 192.168.50.165:2376: connect: connection refused
│ You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
│ Be advised that this will trigger a Docker daemon restart which might stop running containers.
│ 
│ 
│   with minikube_cluster.cluster,
│   on minikube_test.tf line 14, in resource "minikube_cluster" "cluster":
│   14: resource "minikube_cluster" "cluster" {
│ 
╵

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions