1.MINIKUBE AND DOCKER INSTALLATION ON AMAZON LINUX
- Launch an instance from an Amazon Linux 2 or Amazon Linux AMI
- Instance Type - t2.medium
- Proceed without a key-pair
- Create a security group -- Edit security group wilh all traffic
- Storage 15GB
- Launch Instance
-
Connect to your instance
-
Update the packages and package caches you have installed on your instance.
- yum update -y
- Install the latest Docker Engine packages.
- amazon-linux-extras install docker
- Start the Docker service.
- systemctl start docker
- systemctl enable docker
- Install Conntrack and Minikube.
- yum install conntrack -y
- curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
- sudo install minikube-linux-amd64 /usr/local/bin/minikube
- Start your MINIKUBE
- sudo /usr/local/bin/minikube start --force --driver=docker
MAVEN
- cd/opt/
- wget http://mirrors.estointernet.in/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3
bin.tar.gz
- tar xvzf apache-maven-3.6.3-bin.tar.gz
- vi /etc/profile.d/maven.sh
- export MAVEN_HOME=/opt/apache-maven-3.6.3
- export PATH=$PATH:$MAVEN_HOME/bin
GIT
- yum install git -y
JAVA
- yum install java -y
- curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.20.4/2021-04-12/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mkdir -p $HOME/bin
- cp ./kubectl $HOME/bin/kubectl
- export PATH=$HOME/bin:$PATH
- echo'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
- source $HOME/.bashrc
- kubectl version --short –client
- git clone https://github.com/tohidhanfi20/KUBERNETES-MINIKUBE-PROJECT
NOTE - Give your dockerhub ID in place of tohidaws
SERVICE 1 - Shopfront
- cd shopfront/
- mvn clean install -DskipTests
- docker build -t tohidaws/shopfront:latest .
- docker push tohidaws/shopfront:latest
SERVICE 2 - productcatalogue
- cd productcatalogue/
- mvn clean install -DskipTests
- docker build -t tohidaws/productcatalogue:latest .
- docker push tohidaws/productcatalogue:latest
SERVICE 3 - stockmanager
- cd stockmanager/
- mvn clean install -DskipTests
- docker build -t tohidaws/stockmanager:latest .
- docker push tohidaws/stockmanager:latest
GO TO KUBERNETES FOLDER IN SAME PROJECT
- cd kubernetes
- kubectl apply -f shopfront-service.yaml
- kubectl apply -f productcatalogue-service.yaml
- kubectl apply -f stockmanager-service.yaml
- kubectl get pods
Hit the below command to start the kubernetes dashboard in EC2
- /usr/local/bin/minikube dashboard
Open the EC2 in new window and set the PROXY
- kubectl proxy --address='0.0.0.0' --accept-hosts='^*$'
Hit in browser to view the dashboard
- http://<EC2-IP>:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/pod?namespace=default
Hit the below command for each service in different console of EC2
EC2 LOGIN FOR SHOPFRONT
- kubectl port-forward --address 0.0.0.0 svc/shopfront 8080:8010
EC2 LOGIN FOR productcatalogue
- kubectl port-forward --address0.0.0.0 svc/productcatalogue 8090:8020
EC2 LOGIN FOR stockmanager
- kubectl port-forward --address 0.0.0.0 svc/stockmanager 9008:8030
For productcatalogue
- http://<EC2IP>:8090/products
For stockmanager
- http://<EC2IP>:9008/stocks
ANALYZE THE DASHBOARD