I am trying to install kubernetes using kubespray.
I have successfully configured master and worker, but I wanted to know if only masters without workers could be installed. In inventory.ini
, only the hostname of the master was specified and the installation proceeded, and the following failure message was displayed.
Is there a way to install only master excluding worker with kubespray? help!
failed: [node1] (item=kube-node) => {
"ansible_loop_var": "item",
"assertion": "groups.get('kube-node')",
"changed": false,
"evaluated_to": false,
"item": "kube-node",
"msg": "Assertion failed"
}
You can try to use the
ignore_assert_errors=yes
option, I know this may sound like a workaround, but it seems to work as expected. I'm not sure if installing just single master node is covered somewhere in the kubespray documentation.I will create a simple example to illustrate how it works.
Suppose I have one instance and I want it to be the Kubernetes master node:
First, I've prepared the inventory file:
Then I've deployed Kubespray with Ansible Playbook:
NOTE: I've used
-e ignore_assert_errors=yes
option.After successful installation we can check if
node1
is really the master node:As you can see, node
node1
has anode-role.kubernetes.io/master:NoSchedule
taint indicating that it's indeed the master node.