Latest Article

This post gives you an set of Ansible Playbook that would help you to build a Complete Multinode Kubernetes Cluster in an automated way to deploy an containerized application. In the previous post, we have given you the step by step procedure to install and configure kubernetes cluster manually on linux servers using kubeadm and kubectl commands.

You can also refer these below mentioned related links to understand this topic from basics.
What is Kubernetes - Learn Kubernetes from Basics
Create Kubernetes Deployment, Services & Pods Using Kubectl
Create Kubernetes YAML for Deployment, Service & Pods
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
How to Run Docker Containers - Explained with Examples

These playbooks will work on any physical servers, virtual machines, aws cloud, google cloud or any other cloud servers. This has been tested and verified on Centos 7.3 64 bit operating systems.



Let's get started.
kubernetes cluster configuration

We have created these ansible playbooks and stored in our github repository.

List of Files Available in this repository

ansible.cfg - Ansible configuration file created locally.
hosts - Ansible Inventory File
env_variables - Main environment variable file where we have to specify based on our environment.
settingup_kubernetes_cluster.yml - Ansible Playbook to perform prerequisites ready, setting up nodes, configure master node.
configure_worker_nodes.yml - Ansible Playbook to join worker nodes with master node.
clear_k8s_setup.yml - Delete entire configurations from all nodes.
playbooks - Its a directory holds all playbooks.

How to use this ansible playbooks: (Setup Instructions)

Also You can Watch this Tutorial video on our YouTube Channel.
[youtube src="kMKkpgB6IwM" height="315" width="560" /]


Once your servers are ready (one master node and multiple worker nodes), follow these below instructions.

1. Make an entry of your each hosts in /etc/hosts file for name resolution.
cat /etc/hosts
192.168.2.1 kubernetes-master.learnitguide.net kubernetes-master
192.168.2.2 kubernetes-worker1.learnitguide.net kubernetes-worker1
192.168.2.3 kubernetes-worker2.learnitguide.net kubernetes-worker2
2. Make sure kubernetes master node and other worker nodes are reachable between each other.

3. Internet connection must be enabled in all nodes, required packages will be downloaded from kubernetes official yum repository.

4. Clone this repository into your master node.
git clone https://github.com/learnitguide/kubernetes-and-ansible.git
once it is cloned, get into the directory.
cd kubernetes-and-ansible/centos
5. Edit a file "hosts" available in "centos" directory, Just make your entries of your all kubernetes nodes along with respective ip address.

Master Node Entries
[kubernetes-master-nodes]
kubernetes-master.learnitguide.net ansible_host=192.168.2.1
Worker Node Entries
[kubernetes-worker-nodes]
kubernetes-worker1.learnitguide.net ansible_host=192.168.2.2
kubernetes-worker2.learnitguide.net ansible_host=192.168.2.3
6. Edit a file "env_variables" available in "centos" directory and provide your server details like advertise address ip and cidr range values. Dont edit any other values in this file.
ad_addr: 192.168.2.1
cidr_v: 172.16.0.0/16
7. Deploy the ssh key from master node to other nodes for password less authentication to run ansible playbooks. Generate a SSH Key pair using ssh-keygen as below.
ssh-keygen
Enter the required values or just hit enter to take the default values. Copy the public key to all nodes including your master node and make sure you are able to login into any nodes without password. Refer this link to know How to configure SSH Passwordless Login Authentication (SSH-keygen)

8. Setting up Kubernetes Cluster Nodes using Ansible Playbook.
There is a playbook called "settingup_kubernetes_cluster.yml" to setup all nodes and kubernetes master configuration. Just run this playbook using ansible-playbook command first.
ansible-playbook settingup_kubernetes_cluster.yml
9. Joining Worker Nodes
Run "join_kubernetes_workers_nodes.yml" playbook to join the worker nodes with kubernetes master node once "settingup_kubernetes_cluster.yml" playbook tasks are completed.
ansible-playbook join_kubernetes_workers_nodes.yml
Verify the configuration from master node.
kubectl get nodes
That's it, we have successfully configured our kubernetes cluster setup using ansible playbook. you can now try deploying some applications to make sure everything is working fine.
Refer these links to Create Kubernetes Deployment, Services & Pods Using Kubectl and Create Kubernetes YAML for Deployment, Service & Pods

You can also refer these below mentioned related links to understand this topic from basics.
What is Kubernetes - Learn Kubernetes from Basics
What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
How to Run Docker Containers - Explained with Examples

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss 
kubernetes, kubernetes ansible, kubernetes ansible playbooks, kubernets using ansible, install kubernetes with ansible, ansible playbook, deploy kubernetes using ansible, kubernetes ansible deployment, setup kubernets using ansible, install kubernetes cluster using ansible

In this post, we will provide you the step by step procedure of how to create route tables and assign subnets in AWS.
Create Route Tables and Assign Subnets in AWS
A route table contains a set of rules, called routes, that are used to determine where network traffic is directed.

Each subnet in your VPC must be associated with a route table; the table controls the routing for the subnet. A subnet can only be associated with one route table at a time, but you can associate multiple subnets with the same route table.

To make you understand better, lets have a sample VPC architecture as shown in below image as our requirement.
sample vpc architecture
  • 1 VPC (10.0.0.0/16)
  • 2 Subnets - Public Subnet (10.0.1.0/24) and Private Subnet (10.0.2.0/24)
  • 1 Internet Gateway attached to Public Subnet.
Already we have created VPC, Internet Gateway and Subnets (Public and Private). Refer the previous post (AWS VPC | Create New VPC, Subnets, Internet Gateway ) where we have covered,
  1. How to create a New VPC?
  2. How to create Internet Gateway and attach to newly created VPC?
  3. How to create Public Subnet and Private Subnet?
In this post, we will cover only,
  1. How to create Route Tables for Public and Private Subnet?
  2. How to edit Route Tables?
  3. How to add Internet Gateway route to Public Route Table?
  4. How to Associate Public and Private Subnets to respective Route Tables?

Note : In order to create and manage any AWS Services, we must have some valid users created with IAM policy defined. Else you wont have a access to these AWS services.

Login into AWS Management Console.

[ads-post]
I have created my VPC in US East (N. Virginia) region, So, make sure you are in the right region.

aws regions

Go to "Services", type "VPC" in the search box and select the VPC from the search result.

aws vpc services

How to create Route Tables for Public and Private Subnet?

Go to "Route Tables" section from the left side panel.

Create Public Route Table:

By default, one route table is created and attached to VPC. Let's modify the tag name, attach the Internet Gateway to this route table and add the public subnet to it.

Select the route table, pull down "actions" button and select "Add/Edit tags".

aws route table name modify

Click "Create Tag".

aws route table name create tag

Enter the Key "Name" and Value "Public RT".

aws route table modify tag

Go to "Routes" section and click "Edit routes".

aws route table edit routes

Click "Add Route" and Enter the Destination and Target your VPC as below and "Save Routes".

aws route table add internet gateway

Again select the "Public RT" route table and go to "Subnet Associations".

aws route table subnet associations

Click "Edit Subnet Associations", mark only the correct "Public Subnet" which we have created and click "Save".

aws route table add subnet association

Create Private Route Table:

Now click "Create Route Table".

aws create private route table
Enter the name and attach the VPC.

aws create route table

Select the Private Route Table now and go to Subnet Association section. Click "Edit Subnet Associations".

aws route table private subnet association

Mark the correct private subnet this time and click save.

aws route table private subnet configuration

That's it for this post, hope you have got an idea on the below topics.
  1. How to create Route Tables for Public and Private Subnet?
  2. How to edit Route Tables?
  3. How to add Internet Gateway route to Public Route Table?
  4. How to Associate Public and Private Subnets to respective Route Tables?
Refer the previous post (AWS VPC | Create New VPC, Subnets, Internet Gateway ) where we have covered,
  1. How to create a New VPC?
  2. How to create Internet Gateway and attach to newly created VPC?
  3. How to create Public Subnet and Private Subnet?
    To protect the AWS resources in each subnet, We can use multiple layers of security, including security groups and network access control lists (ACL).

    Support Us: Share with your friends and groups.

    Stay connected with us on social networking sites, Thank you.
    YouTube | Facebook | Twitter | Pinterest | Rss 
    Incoming Searches : aws vpc, create aws vpc, how to create vpc in aws, aws create vpc tutorial, amazon aws services, aws cloud, create virtual private cloud, how to create virtual private cloud in aws, aws tutorial, aws tutorial for beginners, aws beginners tutorial, aws tutorial websites, aws tutorial links, aws poc, aws ppt, create aws Route Tables, create Route Tables in aws vpc, add Route Tables in aws vpc, how to create Route Tables in aws, aws Route Tables tutorial

    This post shows you the step by step procedure of how to create a new Virtual Private Cloud (VPC) in Amazon Web Services (AWS) from scratch along with new subnets, new route tables, internet gateway.
    Create New VPC, Subnets, Internet Gateway
    In this post, we will cover,
    1. How to create a New VPC?
    2. How to create Internet Gateway and attach to newly created VPC?
    3. How to create Public Subnet and Private Subnet?
    Refer the Next Post (AWS VPC | Create Route Tables and Assign Subnets in AWS ) where we have covered,
    1. How to create Route Tables for Public and Private Subnet?
    2. How to edit Route Tables?
    3. How to add Internet Gateway route to Public Route Table?
    4. How to Associate Public and Private Subnets to respective Route Tables?
    Before creating all these, we should have some plan about the infrastructure and architecture design like how many ip's we want for our resources, how many subnets? which availability region and zones should we use?. You should have answer for all these.

    To make you understand better, lets have a sample VPC architecture as shown in below image and i will show you based on that how to create and configure VPC.
    sample vpc architecture
    • 1 VPC (10.0.0.0/16)
    • 2 Subnets - Public Subnet (10.0.1.0/24) and Private Subnet (10.0.2.0/24)
    • 1 Internet Gateway attached to Public Subnet.
    In order to create and manage any AWS Services, we must have some valid users created with IAM policy defined. Else you wont have a access to these AWS services.

    Once you have the access, Login into AWS Management Console.

    You can select any region as you preferred. But I am logged into US East (N. Virginia) region, Make sure you are in the right region.

    aws regions


    How to Create a New VPC in AWS?
    [ads-post]
    A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. You can launch your AWS resources, such as Amazon EC2 instances, into your VPC. You can specify an IP address range for the VPC, add subnets, associate security groups, and configure route tables.

    Go to "Services", type "VPC" in the search box and select the VPC from the search result.

    aws vpc services

    Go to "Your VPC" from the left side panel.

    aws create new vpc

    Click "Create VPC".

    aws create vpc

    Enter the Name Tag you prefer, i just give "my_demo_vpc".
    Enter the range of IP address in the IPv4 CIDR block : 10.0.0.0/16
    Select "No IPv6 CIDR Block" in IPv6 CIDR block.
    Select "Default" in the tenancy.
    Click "Create"
    aws create new vpc settings

    You will get the confirmation message like this, just close the message.

    vpc creation

    Once you have created new VPC, you will see all VPC available in the region including the newly created one.

    aws vpc list

    How to Create Internet Gateway in AWS?
    An internet gateway enables your instances to connect to the internet through the Amazon Network.

    Go to "Internet Gateway" option from the left side panel and click "Internet gateway".

    create internet gateway in aws

    Enter the Name of the Internet Gateway "my-igw" and click "Create".

    configure internet gateway aws

    Once it is created, just right click the newly created internet gateway and click "Attach to VPC".

    attach internet gateway to vpc
    Select the appropriate VPC and click "Attach", so that it enables the communication with the internet.

    aws internet gateway name

    Now it will list the available Internet gateway.

    aws internet gateway list

    How to Create Subnets in AWS?
    A subnet is a range of IP addresses in your VPC. You can launch AWS resources into a specified subnet. Use a public subnet for resources that must be connected to the internet, and a private subnet for resources that won't be connected to the internet.

    As per our requirement, we need to create two subnets ie. Public Subnet and Private Subnet.

    Create Public Subnet:
    Go to Subnet option from the left side panel and click "Create Subnet".

    create aws vpc subnets

    Enter the public subnet details including name, associated vpc, ipv4 cidr block and click create.

    create aws vpc public subnet

    Create Private Subnet:
    Public Subnet is created, now again click "Create Subnet". to create private subnet.

    aws vpc public subnet list

    Enter the private subnet details including name, associated vpc, ipv4 cidr block and click create.

    create aws vpc private subnet

    Now we have created both public subnet and private subnet in AWS VPC.

    That's it for this post, hope you have got an idea on the below topics.
    1. How to create a New VPC?
    2. How to create Internet Gateway and attach to newly created VPC?
    3. How to create Public Subnet and Private Subnet?
    Refer the Next Post (AWS VPC | Create Route Tables and Assign Subnets in AWS ) where we have covered,
    1. How to create Route Tables for Public and Private Subnet?
    2. How to edit Route Tables?
    3. How to add Internet Gateway route to Public Route Table?
    4. How to Associate Public and Private Subnets to respective Route Tables?
    Support Us: Share with your friends and groups.

    Stay connected with us on social networking sites, Thank you.
    YouTube | Facebook | Twitter | Pinterest | Rss 
    Incoming Searches : aws vpc, create aws vpc, create subnets in aws vpc, create internet gateway in aws vpc, how to create vpc in aws, aws create vpc tutorial, aws create vpc subnet, aws create vpc internet gateway, aws create vpc with internet gateway, amazon aws services, aws cloud, create virtual private cloud, how to create virtual private cloud in aws, aws tutorial, aws tutorial for beginners, aws beginners tutorial, aws tutorial websites, aws tutorial links, aws poc, aws ppt

    Contact Form

    Name

    Email *

    Message *

    Powered by Blogger.
    Javascript DisablePlease Enable Javascript To See All Widget