How to fix – 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
- Kubernetes Cheat Sheet for day to day DevOps operations?
- Delete Kubernetes POD stuck in terminating state?
- How to Delete PV(Persistent Volume) and PVC(Persistent Volume Claim) stuck in terminating state?
- Share kubernetes secrets between namespaces?
- How to use Kubernetes secrets?
- How to delete all kubernetes PODS?
- kubernetes pods getting recreated?
- Implementing Kubernetes liveness, Readiness and Startup probes with Spring Boot Microservice Application?
- kubectl export yaml OR How to generate YAML for deployed kubernetes resources
- Kubernetes Updates
- CI/CD Kubernetes | Setting up CI/CD Jenkins pipeline for kubernetes
- Kubernetes cluster setup with Jenkins
- How to use Persistent Volume and Persistent Claims | Kubernetes
- How to fix ProvisioningFailed persistentvolume controller no volume plugin matched
- Fixing – Cannot bind to requested volume: storageClasseName does not match
- Fixing – pod has unbound immediate persistentvolumeclaims or cannot bind to requested volume incompatible accessmode
- How to fix kubernetes dashboard forbidden 403 error – message services https kubernetes-dashboard is forbidden User
- How to fix Kubernetes – error execution phase preflight [preflight]
- Deploy Spring Boot microservices on kubernetes?
- How to fix – ansible_memtotal_mb minimal_master_memory_mb
- How to use kubespray – 12 Steps for Installing a Production Ready Kubernetes Cluster
- How to setup kubernetes on CentOS 8 and CentOS 7
- How to fix – How to fix - ERROR Swap running with swap on is not supported. Please disable swap
- 14 Steps to Install kubernetes on Ubuntu 20.04(bento/ubuntu-20.04), 18.04(hashicorp/bionic64)
- Kubernetes Dashboard | Kubernetes Admin GUI | Kubernetes Desktop Client
- Install Kubernetes with Minikube