Deploying Docker Swarm on Rocky Linux
Welcome to an exciting and practical journey into container orchestration!
In this guide, you will deploy a highly available Docker Swarm cluster across three Rocky Linux servers. Through a series of carefully structured steps, you will gain hands-on experience installing, configuring, and managing containerized services on Rocky Linux, sharpening your skills in modern IT infrastructure and cloud-native technologies. By the end of this exercise, you will be better equipped to manage and scale containerized applications confidently and efficiently.
Testbed Configuration
Host | IP Address |
SwarmManager | 192.168.10.131 |
RNode1 | 192.168.10.135 |
RNode2 | 192.168.10.136 |
Step 1: Initial Configuration of SwarmManager Node
Begin by preparing the Swarm Manager node:
# Add Docker repository
# Verify repository list
# Update the system
# Install Docker Engine and related components
# Enable and start the Docker service
# Add user to Docker group for non-root access
# Configure Firewall for Swarm Communication
# Initialize Docker Swarm
Step 2: Adding Worker Nodes to the Swarm
Now, configure each worker node to join the cluster.
RNode1 Setup:
# Update and prepare the system
# Add Docker repository
# Install Docker Engine and related components
# Enable and start Docker
# Add user to Docker group
# Allow necessary firewall ports
# Join the Swarm cluster
Note: Replace <your-token> with the actual token generated during the Swarm initialization.
RNode2 Setup:
# Update and prepare the system
# Add Docker repository
# Install Docker Engine and related components
# Enable and start Docker
# Add user to Docker group
# Allow necessary firewall ports
# Join the Swarm cluster
Step 3: Verifying Swarm Node Status
Confirm that all nodes have successfully joined the cluster:
# List all nodes in the Swarm
# Detailed Swarm information
You should observe three nodes: one Manager and two Workers.
Step 4: Creating and Managing Services on Docker Swarm
Launch your first containerized service on the Swarm:
# Deploy a simple HTTP service
# Verify the service
# Test service availability
Step 5: Scaling Services Dynamically
Experience the power of scaling services with a single command:
# Scale the service to 3 replicas
# Verify replica distribution
Step 6: Testing Service Across Nodes
Validate service accessibility across different nodes:
# List running containers
# Test service on each node
You should receive consistent responses, demonstrating load distribution and service availability across your Swarm cluster!
Conclusion
Congratulations! By completing this guide, you have successfully deployed and managed a multi-node Docker Swarm cluster on Rocky Linux. You now possess fundamental expertise in container orchestration, service scaling, and distributed system management, critical skills that are in high demand across the IT industry. Keep experimenting, keep building, and let this accomplishment fuel your journey into the vast world of cloud-native technologies!