How to fix – ansible_memtotal_mb minimal_master_memory_mb

ansible_memtotal_mb >= minimal_master_memory_mb

I faced this issue during Kubernetesinstallation using kubespray. If you are facing a similar issue with your ansible-playbook then it is time to increase the memory of your VMs

For kubernetes installation using kubespray, please refer to kubespray – 12 Steps for Installing a Production Ready Kubernetes Cluster

Root Cause -

Ansible need more memory for running playbook on your linux machine.

In my setup i was using Vagrant for spinning up my VMs(virtual machine). But one of the VM had only 1 GB of memory.

Note - Look at my vagrant file configuration for kmaster node, i have allocated only 1024M of memory and 1 CPU

Vagrantfile

 1Vagrant.configure("2") do |config|
 2  config.vm.define "amaster" do |amaster|
 3    amaster.vm.box_download_insecure = true
 4    amaster.vm.box = "hashicorp/bionic64"
 5    amaster.vm.network "private_network", ip: "100.0.0.1"
 6    amaster.vm.hostname = "amaster"
 7    amaster.vm.provider "virtualbox" do |v|
 8      v.name = "amaster"
 9      v.memory = 2048
10      v.cpus = 2
11    end
12  end
13
14  config.vm.define "kmaster" do |kmaster|
15    kmaster.vm.box_download_insecure = true
16    kmaster.vm.box = "hashicorp/bionic64"
17    kmaster.vm.network "private_network", ip: "100.0.0.2"
18    kmaster.vm.hostname = "kmaster"
19    kmaster.vm.provider "virtualbox" do |v|
20      v.name = "kmaster"
21      v.memory = 1024
22      v.cpus = 1
23    end
24  end
25
26end


Solution: -

If you are using Vagrant for provisioning your VMs(virtual machine) then you only need to increase the memory and cpus to fix the problem.

Fix 1- Increase memory from 1024 to 2048

v.memory = 2048

Fix 2 - Increase CPUs from 1 to 2

1v.cpus = 2

So your final Vagranfile should look like this

 1Vagrant.configure("2") do |config|
 2  config.vm.define "amaster" do |amaster|
 3    amaster.vm.box_download_insecure = true
 4    amaster.vm.box = "hashicorp/bionic64"
 5    amaster.vm.network "private_network", ip: "100.0.0.1"
 6    amaster.vm.hostname = "amaster"
 7    amaster.vm.provider "virtualbox" do |v|
 8      v.name = "amaster"
 9      v.memory = 2048
10      v.cpus = 2
11    end
12  end
13
14  config.vm.define "kmaster" do |kmaster|
15    kmaster.vm.box_download_insecure = true
16    kmaster.vm.box = "hashicorp/bionic64"
17    kmaster.vm.network "private_network", ip: "100.0.0.2"
18    kmaster.vm.hostname = "kmaster"
19    kmaster.vm.provider "virtualbox" do |v|
20      v.name = "kmaster"
21      v.memory = 2048
22      v.cpus = 2
23    end
24  end
25
26end
1fatal: [node2]: FAILED! => {
2    "assertion": "ansible_memtotal_mb >= minimal_master_memory_mb",
3    "changed": false,
4    "evaluated_to": false,
5    "msg": "Assertion failed"
6}


Posts in this Series