remche / terraform-openstack-rke

Terraform Openstack RKE
Mozilla Public License 2.0
37 stars 20 forks source link

Receiving errors #64

Closed arkanmgerges closed 4 years ago

arkanmgerges commented 4 years ago

Hi, I'm trying to install RKE but I'm receiving some errors.

Openstack version: "Train"

terraform.tvars:

edge_count    = 1
worker_count  = 1
master_count = 1

master_labels = { "node-role.kubernetes.io/master" = "true" }
edge_labels   = { "node-role.kubernetes.io/edge" = "true" }
public_net_name = "provider"
master_flavor_name = "a.large"
worker_flavor_name = "a.large"
edge_flavor_name = "a.large"

cluster_name = "rke"
ssh_keypair_name = "local"
nodes_net_cidr = "10.13.0.0/24"
dns_servers = ["8.8.8.8"]
dns_domain = "arkan.cloud."

use_ssh_agent = false

image_name = "ubuntu-18.04-minimal-cloudimg-amd64"
user_data_file = "rancher.yml"
acme_email = "arkan.m.gerges@gmail.com"

rancher.yml

#cloud-config

ssh_authorized_keys:
    - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCYQykR9v8sGtHV0fl1Otm8N3nGFUYg8iO5IhODQO1zHtIAB8/px0JSu8g1EifbXzvx3GUUYDW2lNBbUYPOP1Os27M6lYz68qYKxMjLXraEHt9jNe7aUVIyNu2iGc3ZAgSrkRabw7P05ijLdH3A6MscQnc4tqLE92a3z/QGcANvtymJvpkvhuE3iUz92NxyR9AHaj9ejGbzJ2vu9kISVx2cUEvymW6x8zGh/agljsIXcp/KYUVr/MvpfVrdk7tUrLg3vAN5+273pWRGNTrtEdwhxBvSAYyU/p/C66G7ZHAILKj45rm0kpNqCNeQh2UiwmDbFEqQmtSZsEHKwRNCbdAx arkan@DESKTOP-8FQ42NL

packages:
    - docker.io

# create the docker group
groups:
    - docker

# Add default auto created user to docker group
system_info:
    default_user:
        groups: [docker]

Debug with Errors

arkanmgerges commented 4 years ago

Hi based on SSH Connectivity Errors, I observed that docker was under installation, the process of rke_cluster is checking if docker is working, but docker at that time was not installed, because the installation was in progress. After the error I verified that docker was installed and I can docker ps from the ubuntu user. So I did the following to solve this issue:

in the file modules/rke/main.tf from line 54: I've added delay_on_creation = var.delay_on_creation

resource "rke_cluster" "cluster" {
  # The following code was added 
  delay_on_creation = var.delay_on_creation

In the file modules/rke/variables.tf, I've added the variable delay_on_creation at the end of the file:

variable "delay_on_creation" {
  type = number
  default = 60
}

Then after applying to terraform, RKE was installed successfully.

I will leave this issue open, maybe somebody will add comment or other suggestions.

remche commented 4 years ago

Hi,

Thanks for the report. The module assumes that the image already has docker installed which makes its faster and more predictable. Packer is an easy way to cook your images

However, it should not be too complex to patch the wait_for_ssh resource to wait for docker running on host. Stay tuned ;)

remche commented 4 years ago

@arkanmgerges could you please try dac8ce0 ?

arkanmgerges commented 4 years ago

Hi remche, thanks for the commit dac8ce0.

  1. BTW, where can I find a cloud image (ubuntu) that has already docker installed ?
  2. After installing Kubernetes using your code, where can I find 'kubeconfig', usually when running rke up --config ./rancher-cluster.yml, rke will create kube_config_rancher-cluster.yml as kubeconfig so I can use it with kubectl and helm for installing Rancher?
remche commented 4 years ago
1. BTW, where can I find a cloud image (ubuntu) that has already docker installed ?

You wont find such official images, my advice is to use Packer to cook yours. You can find a working packer file here.

  1. After installing Kubernetes using your code, where can I find 'kubeconfig', usually when running rke up --config ./rancher-cluster.yml, rke will create kube_config_rancher-cluster.yml as kubeconfig so I can use it with kubectl and helm for installing Rancher? Unless you specified write_kubeconfig = false, you should find in the path.root directory.
arkanmgerges commented 4 years ago

Thanks a lot remche for your help.