Skip to main content

AWS Security Specialty Exam Practice Test

How to setup a swarm mode cluster, with managers and worker nodes

Setup swarm mode cluster, with managers and worker nodes

I have used GCP for creating compute engines as we get 300$ free credit. You can follow steps in https://cloud.google.com/compute/docs/quickstart-linux to get started with the creation of vm's. Make sure that you select f1.micro instances to be in the free tier limit. More details on GCP free tier:https://cloud.google.com/free/. However you can spin instance either in GCP, Azure or Aws to get started quickly. Once after creation on VM, install docker using yum install docker -y ( I have used CentOS distribution).

We will start by creating a Docker swarm cluster with one master node and one working node. Docker swarm comes by default with docker installation and doesn't require any additional installations. Execute the command docker swarm init to initialize docker swarm in the manager node. We get a swarm token to run on the node and also for adding another manager


Adding a worker node to the swarm cluster -

Once after creating cluster, the workers and managers can be viewed by executing the command docker node ls on the manager. Running the command docker node ls on nodes throws an error responce saying  Worker nodes can't be used to view or modify cluster state.



Comments

Post a Comment

Popular posts from this blog

AWS Security Specialty Exam Practice Test

Google Cloud VPC Basics for Associate Cloud Engineer - Part 1

Installing Ansible with CloudFormation and Userdata

AWS game-changing feature of supporting YAML in Cloudformation is a blessing for people who would love to see things in a "proper" format with comments :). Also it reduces the number of lines when compared to JSON. Thanks to Graham  for his basic tutorial on YAML and CloudFormation, borrowed much of his code and added ansible install. I haven't used cfn-init in the below snippet. Will try to enhance the code in future and make it more sophisticated. Please note: I have hard-coded values of my key-pair etc, feel free to remove them. Please do leave a comment if you are running into any issues. I have used RHEL image for this tutorial. AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Parameters: FilePath: Description: The path of the file. Type: String Default: /home/ec2-user/userdata Resources: MyEC2Instance: Type: "AWS::EC2::Instance" # 1 Quotes are unnecessary here - will they always be? Pr