Skip to content

Update the IP address in (hosts, nginx.conf & project_vars) file with the current EC2 IP then run Ansible inventory to configure EC2, install Kubernetes (K3s) & deploy our app in Kubernetes.

Notifications You must be signed in to change notification settings

bjnandi/ansible-k3s-nginx-lb

Repository files navigation

Configure EC2, Install Kubernetes (K3s) & Deploy MERN App using Ansible

Step 1: Clone the repository in the local machine

git clone https://github.com/bjnandi/ansible-k3s-nginx-lb.git

Step 2: Create a “linux.pem” file in the .ssh folder for the SSH key

nano ~/.ssh/linux.pem

Step 3: Set the permission of the “linux.pem” file

chmod 400 ~/.ssh/linux.pem

Step 4: Now set permission for the directory because the Dev Container mounts the directory with default permission for everyone

chmod 755 /workspaces/ansible-k3s-nginx-lb

Step 5: Now update the IP address with our AWS EC2 IP address

  • In the “hosts” file:
  • bastion (Public IP)
  • k3s_nodes, additional_agent_nodes & nginx_lb (Private IP)
  • nginx_lb(Private IP)
  • For ProxyCommand (Public IP)

Step 6: The Ansible configuration is ready for run

  1. To run all configurations in one comment using Makefile:
make run_ansible
  1. If you want run them one by one:
 ansible-playbook -i hosts k3s_install.yaml

 ansible-playbook -i hosts k3s_mern_deploy.yaml

 ansible-playbook -i hosts config_nginx_lb.yaml

 ansible-playbook -i hosts config_bastion.yaml

Learn More Here

Build an End-to-End CI/CD Pipeline for a MERN App in Kubernetes with Terraform using GitHub Actions & Ansible

Happy coding! 💻✨

About

Update the IP address in (hosts, nginx.conf & project_vars) file with the current EC2 IP then run Ansible inventory to configure EC2, install Kubernetes (K3s) & deploy our app in Kubernetes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published