Coder Social home page Coder Social logo

metal-cloud's People

Contributors

achetronic avatar jrpedrianes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jrpedrianes

metal-cloud's Issues

Network issues in machines with two networks

Reviewing the current network configuration I get some "warnings" when I want to apply it again:

root@lb-01:~# netplan apply 

** (generate:2128): WARNING **: 09:49:24.457: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.

** (generate:2128): WARNING **: 09:49:24.457: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.

** (generate:2128): WARNING **: 09:49:24.457: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in ens3 but also in ens4

Also if I check the current "IP routes" applied to the machine, I get that has configured more than one default route, in my case I have 3 :

root@lb-01:~# ip route
default via 10.10.10.1 dev ens3 proto static onlink 
default via 192.168.1.1 dev ens4 proto static 
default via 10.10.10.1 dev ens3 proto dhcp src 10.10.10.10 metric 100 
10.10.10.0/24 dev ens3 proto kernel scope link src 10.10.10.10 metric 100 
10.10.10.1 dev ens3 proto dhcp scope link src 10.10.10.10 metric 100 
192.168.1.0/24 dev ens4 proto kernel scope link src 192.168.1.210 

Reviewing the applied configuration, which you can see next, I saw that you are using deprecated configurations and also you are not defining any default route:

network:
    ethernets:
        ens3:
            dhcp4: true
            gateway4: 10.10.10.1
            nameservers:
                addresses:
                - 4.4.4.4
                - 8.8.8.8
                search:
                - virnat0.nat.local
        ens4:
            addresses:
            - 192.168.1.210/24
            dhcp4: false
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                - 4.4.4.4
                - 8.8.8.8
                search:
                - external0.macvtap.local
    version: 2

Seems that these configurations: dhcp4: true, gateway4: 10.10.10.1 and gateway4: 192.168.1.1 are the culprits that appear more than one default route.

Maybe is better don't use DHCP, pin the IP to the network and define a "default" route, as follows:

network:
    ethernets:
        ens3:
            addresses:
            - 10.10.10.20/24
            nameservers:
                addresses:
                - 4.4.4.4
                - 8.8.8.8
                search:
                - virnat0.nat.local
        ens4:
            addresses:
            - 192.168.1.210/24
            nameservers:
                addresses:
                - 4.4.4.4
                - 8.8.8.8
                search:
                - external0.macvtap.local
            routes:
                - to: default
                  via: 192.168.1.1
    version: 2

In this commit you can see all the modifications that I have applied to the metal-could project to get this network configuration:

jrpedrianes@b95b82d

In summary:

  • Don't use DHCP, so we configure libvirt_network to doesn't start up the DHCP service.
  • Pin the IP to the network, so we don't attach the IP in the libvirt_domain terraform configuration.
  • Mark one network interface as default to add the default route only to one network configuration.

Error: storage pool 'volume_pool' already exists

I'm trying to build a basic set of VM's based on the next configuration:

locals {
  # Networks definition
  # Possible types: nat, macvtap
  # nat: Virtual interface with a subnetwork to attach instances
  # macvtap: Virtual interface connected directly to a host physical interface, sharing the same network
  networks = {
    external0 = {
      mode = "macvtap"
      interface = "wlo1"
      dhcp_address_blocks = ["192.168.100.0/24"]
      gateway_address = "192.168.100.1"
    }
  }
  instances = {

    # Define the LoadBalancer
    kube-loadbalancer-0 = {
      vcpu     = 2
      memory   = 2048 # 2GB
      disk     = 10000000000 # 1GB
      networks = [{
          name    = "external0"
          address = "192.168.100.10/24"
        }
      ]
    }

    # Define the masters
    kube-master-0 = {
      vcpu     = 2
      memory   = 2048 # 2GB
      disk     = 10000000000 # 10GB
      networks = [
        {
          name    = "external0"
          address = "192.168.100.201/24"
        }
      ]
    }

    kube-master-1 = {
      vcpu     = 2
      memory   = 2048 # 2GB
      disk     = 10000000000 # 10GB
      networks = [
        {
          name    = "external0"
          address = "192.168.100.202/24"
        }
      ]
    }

    # Define the workers
    kube-worker-0 = {
      vcpu     = 2
      memory   = 2048 # 2GB
      disk     = 20000000000 # 20GB
      networks = [
        {
          name    = "external0"
          address = "192.168.100.203/24"
        }
      ]
    }
  }

}

I already performed the next commands beforehand:

$ terraform init && terraform apply --target module.init

When I apply all the plan I got:


module.workload.random_string.instance_password["kube-worker-0"]: Creating...
module.workload.random_string.instance_password["kube-master-0"]: Creating...
module.workload.random_string.instance_password["kube-loadbalancer-0"]: Creating...
module.workload.random_string.instance_password["kube-worker-0"]: Creation complete after 0s [id=yCh3KRbD3qzcDwBT]
module.init.null_resource.upload_public_key: Creating...
module.workload.random_string.instance_password["kube-master-1"]: Creating...
module.init.null_resource.install_dependencies: Creating...
module.workload.random_string.instance_password["kube-loadbalancer-0"]: Creation complete after 0s [id=vD7YVVJnWcAPrN21]
module.workload.random_string.instance_password["kube-master-0"]: Creation complete after 0s [id=LyBqzt1li1wlR9Ux]
module.init.null_resource.install_dependencies: Provisioning with 'file'...
module.init.null_resource.upload_public_key: Provisioning with 'local-exec'...
module.init.null_resource.upload_public_key (local-exec): Executing: ["/bin/sh" "-c" "echo oscar2005ivan | ssh-copy-id -f [email protected]"]
module.workload.random_string.instance_password["kube-master-1"]: Creation complete after 0s [id=sRVaPLI446ApZffU]
module.workload.libvirt_pool.volume_pool: Creating...
module.init.null_resource.install_dependencies: Provisioning with 'remote-exec'...
module.init.null_resource.install_dependencies (remote-exec): Connecting to remote host via SSH...
module.init.null_resource.install_dependencies (remote-exec):   Host: 192.168.100.149
module.init.null_resource.install_dependencies (remote-exec):   User: oscar
module.init.null_resource.install_dependencies (remote-exec):   Password: true
module.init.null_resource.install_dependencies (remote-exec):   Private key: true
module.init.null_resource.install_dependencies (remote-exec):   Certificate: false
module.init.null_resource.install_dependencies (remote-exec):   SSH Agent: true
module.init.null_resource.install_dependencies (remote-exec):   Checking Host Key: false
module.init.null_resource.install_dependencies (remote-exec):   Target Platform: unix
module.init.null_resource.install_dependencies (remote-exec): Connected!
module.init.null_resource.install_dependencies (remote-exec): [sudo] password for oscar: [···] Installing dependencies for the user: oscar
module.init.null_resource.install_dependencies (remote-exec): [···] Installing CPU checker
module.init.null_resource.install_dependencies (remote-exec): Reading package lists... 0%
module.init.null_resource.install_dependencies (remote-exec): Reading package lists... 100%
module.init.null_resource.install_dependencies (remote-exec): Reading package lists... Done

module.init.null_resource.upload_public_key (local-exec): Number of key(s) added:        1

module.init.null_resource.upload_public_key (local-exec): Now try logging into the machine, with:   "ssh '[email protected]'"
module.init.null_resource.upload_public_key (local-exec): and check to make sure that only the key(s) you wanted were added.

module.init.null_resource.upload_public_key: Creation complete after 1s [id=8806305865907417442]
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree... 0%
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree... 0%
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree... 50%
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree... 50%
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree
module.init.null_resource.install_dependencies (remote-exec): Reading state information... 0%
module.init.null_resource.install_dependencies (remote-exec): Reading state information... 0%
module.init.null_resource.install_dependencies (remote-exec): Reading state information... Done
module.init.null_resource.install_dependencies (remote-exec): cpu-checker is already the newest version (0.7-1.1).
module.init.null_resource.install_dependencies (remote-exec): The following packages were automatically installed and are no longer required:
module.init.null_resource.install_dependencies (remote-exec):   ieee-data libfprint-2-tod1 libllvm10
module.init.null_resource.install_dependencies (remote-exec):   libllvm11 libllvm11:i386
module.init.null_resource.install_dependencies (remote-exec):   libxdamage1:i386 python3-argcomplete
module.init.null_resource.install_dependencies (remote-exec):   python3-dnspython python3-jmespath
module.init.null_resource.install_dependencies (remote-exec):   python3-kerberos python3-libcloud
module.init.null_resource.install_dependencies (remote-exec):   python3-netaddr python3-ntlm-auth
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-kerberos
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-ntlm
module.init.null_resource.install_dependencies (remote-exec):   python3-selinux python3-winrm
module.init.null_resource.install_dependencies (remote-exec):   python3-xmltodict shim ubuntu-fan
module.init.null_resource.install_dependencies (remote-exec): Use 'sudo apt autoremove' to remove them.
module.init.null_resource.install_dependencies (remote-exec): 0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
module.init.null_resource.install_dependencies (remote-exec): [···] Checking KVM availability
module.init.null_resource.install_dependencies (remote-exec): INFO: /dev/kvm exists
module.init.null_resource.install_dependencies (remote-exec): KVM acceleration can be used
module.init.null_resource.install_dependencies (remote-exec): [···] Updating packages lists
module.init.null_resource.install_dependencies (remote-exec): Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
module.init.null_resource.install_dependencies (remote-exec): Get:4 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
module.init.null_resource.install_dependencies (remote-exec): Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
module.init.null_resource.install_dependencies (remote-exec): Hit:6 http://mx.archive.ubuntu.com/ubuntu focal InRelease
module.init.null_resource.install_dependencies (remote-exec): Get:7 http://mx.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
module.init.null_resource.install_dependencies (remote-exec): Hit:8 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease
module.init.null_resource.install_dependencies (remote-exec): Hit:3 https://packages.gitlab.com/runner/gitlab-runner/ubuntu focal InRelease
module.init.null_resource.install_dependencies (remote-exec): Get:9 http://mx.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
module.init.null_resource.install_dependencies (remote-exec): Get:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9 383 B]
module.init.null_resource.install_dependencies (remote-exec): Err:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
module.init.null_resource.install_dependencies (remote-exec):   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
module.init.null_resource.install_dependencies (remote-exec): Fetched 386 kB in 1s (269 kB/s)
module.init.null_resource.install_dependencies (remote-exec): Reading package lists...

module.init.null_resource.install_dependencies (remote-exec): W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.cloud.google.com/apt kubernetes-xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
module.init.null_resource.install_dependencies (remote-exec): W: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
module.init.null_resource.install_dependencies (remote-exec): W: Some index files failed to download. They have been ignored, or old ones used instead.
module.init.null_resource.install_dependencies (remote-exec): [···] Installing virtualization packages
module.init.null_resource.install_dependencies (remote-exec): Reading package lists...
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree...

module.init.null_resource.install_dependencies (remote-exec): Reading state information...
module.init.null_resource.install_dependencies (remote-exec): bridge-utils is already the newest version (1.6-2ubuntu1).
module.init.null_resource.install_dependencies (remote-exec): libvirt-clients is already the newest version (6.0.0-0ubuntu8.14).
module.init.null_resource.install_dependencies (remote-exec): libvirt-daemon-system is already the newest version (6.0.0-0ubuntu8.14).
module.init.null_resource.install_dependencies (remote-exec): qemu-kvm is already the newest version (1:4.2-3ubuntu6.18).
module.init.null_resource.install_dependencies (remote-exec): The following packages were automatically installed and are no longer required:
module.init.null_resource.install_dependencies (remote-exec):   ieee-data libfprint-2-tod1 libllvm10
module.init.null_resource.install_dependencies (remote-exec):   libllvm11 libllvm11:i386
module.init.null_resource.install_dependencies (remote-exec):   libxdamage1:i386 python3-argcomplete
module.init.null_resource.install_dependencies (remote-exec):   python3-dnspython python3-jmespath
module.init.null_resource.install_dependencies (remote-exec):   python3-kerberos python3-libcloud
module.init.null_resource.install_dependencies (remote-exec):   python3-netaddr python3-ntlm-auth
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-kerberos
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-ntlm
module.init.null_resource.install_dependencies (remote-exec):   python3-selinux python3-winrm
module.init.null_resource.install_dependencies (remote-exec):   python3-xmltodict shim ubuntu-fan
module.init.null_resource.install_dependencies (remote-exec): Use 'sudo apt autoremove' to remove them.
module.init.null_resource.install_dependencies (remote-exec): 0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
module.init.null_resource.install_dependencies (remote-exec): [···] Adding user oscar to the group: libvirt
module.init.null_resource.install_dependencies (remote-exec): The user `oscar' is already a member of `libvirt'.
module.init.null_resource.install_dependencies (remote-exec): [···] Disabling security driver for Qemu
module.init.null_resource.install_dependencies (remote-exec): [···] Restarting libvirt to apply all changes
module.init.null_resource.install_dependencies (remote-exec): [···] Installing Cockpit
module.init.null_resource.install_dependencies (remote-exec): Reading package lists...
module.init.null_resource.install_dependencies (remote-exec): Building dependency tree...

module.init.null_resource.install_dependencies (remote-exec): Reading state information...
module.init.null_resource.install_dependencies (remote-exec): cockpit is already the newest version (215-1).
module.init.null_resource.install_dependencies (remote-exec): cockpit-machines is already the newest version (215-1).
module.init.null_resource.install_dependencies (remote-exec): The following packages were automatically installed and are no longer required:
module.init.null_resource.install_dependencies (remote-exec):   ieee-data libfprint-2-tod1 libllvm10
module.init.null_resource.install_dependencies (remote-exec):   libllvm11 libllvm11:i386
module.init.null_resource.install_dependencies (remote-exec):   libxdamage1:i386 python3-argcomplete
module.init.null_resource.install_dependencies (remote-exec):   python3-dnspython python3-jmespath
module.init.null_resource.install_dependencies (remote-exec):   python3-kerberos python3-libcloud
module.init.null_resource.install_dependencies (remote-exec):   python3-netaddr python3-ntlm-auth
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-kerberos
module.init.null_resource.install_dependencies (remote-exec):   python3-requests-ntlm
module.init.null_resource.install_dependencies (remote-exec):   python3-selinux python3-winrm
module.init.null_resource.install_dependencies (remote-exec):   python3-xmltodict shim ubuntu-fan
module.init.null_resource.install_dependencies (remote-exec): Use 'sudo apt autoremove' to remove them.
module.init.null_resource.install_dependencies (remote-exec): 0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
module.init.null_resource.install_dependencies: Creation complete after 5s [id=7598101105588966188]
╷
│ Error: storage pool 'volume_pool' already exists
│ 
│   with module.workload.libvirt_pool.volume_pool,
│   on modules/workload/storage.tf line 2, in resource "libvirt_pool" "volume_pool":
│    2: resource "libvirt_pool" "volume_pool" {
│ 
╵

I've checked the host volume_pool location and doesn't exist and using vmsh I can't see any libvirt_pool created:

virsh # pool-list
 Name      State    Autostart
-------------------------------
 default   active   yes

virsh #

The environment is as follows:

  • Ubuntu 20.04
  • Terraform v1.0.9 on darwin_amd64
  • provider registry.terraform.io/dmacvicar/libvirt v0.6.11
  • provider registry.terraform.io/hashicorp/null v3.1.0
  • provider registry.terraform.io/hashicorp/random v3.1.0

What should be missing ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.