Home > Mobile >  How to specify "master" and "worker" nodes when using one machine to run Kuberne
How to specify "master" and "worker" nodes when using one machine to run Kuberne

Time:12-13

I am using an Ubuntu 22.04 machine to run and test Kubernetes locally. I need some functionality like Docker-Desktop. I mean it seems both master and worker nodes/machines will be installed by Docker-Desktop on the same machine. But when I try to install Kubernetes and following the instructions like this, at some points it says run the following codes on master node:

sudo hostnamectl set-hostname kubernetes-master

Or run the following comands on the worker node machine:

sudo hostnamectl set-hostname kubernetes-worker

I don't know how to specify master/worker nodes if I have only my local Ubuntu machine?

Or should I run join command after kubeadm init command? Because I can't understand the commands I run in my terminal will be considered as a command for which master or worker machine?

I am a little bit confused about this master/worker nodes or client/server machine stuff while I am just using one machine for both client and server machines.

CodePudding user response:

play-with-k8s is an online k8s playground where you can create master and multiple worker nodes.Here's the link to the site. your session will be deleted automatically in 4 hours.

Note: you need docker or github account to login.

CodePudding user response:

Prerequisites for installing kubernetes in cluster:

  1. Ubuntu instance with 4 GB RAM - Master Node - (with ports open to all traffic)
  2. Ubuntu instance with at least 2 GB RAM - Worker Node - (with ports open to all traffic)

It means you need to create 3 instances from any cloud provider like Google (GCP), Amazon (AWS), Atlantic.Net Cloud Platform, cloudsigma as per your convenience.

For creating an instance in gcp follow this guide. If you don’t have an account create a new account ,New customers also get $300 in free credits to run, test, and deploy workloads.

After creating instances you will get ips of the instance using them you can ssh into the instance using terminal in your local machine by using the command: ssh root@<ip address>

From there you can follow any guide for installing kubernetes by using worker and master nodes.

example:

sudo hostnamectl set-hostname <host name>

Above should be executed in the ssh of the worker node, similarly you need to execute it into the worker node.

  • Related