This is a simple website written in Golang. It uses the net/http package to serve HTTP requests.
To run the server, execute the following command:
go run main.goThe server will start on port 8080. You can access it by navigating to http://localhost:8080/courses in your web browser.
docker build -t adeshbode/go-web-app .
docker run -p 8080:8080 -it adeshbode/go-web-app
Install: kubectl( primarytool for talking to Kubernetes) and eksctl (simplifies the process of creating, updating, and managing EKS clusters)- both uses aws cli config credentials
eksctl create cluster --name demo-cluster --region us-east-1
kubectl apply -f k8s/manifests/deployment.yaml
check: kubectl get pods
kubectl apply -f k8s/manifests/service.yaml
kubectl get svc kubectl edit svc go-web-app // name from above command output // edit the ip from ClusterIP to NodePort
// use export KUBE_EDITOR=vim if opening in notepad
kubectl get svc // now copy the port from the record with type nodeport ex. 80:31985/TCP -- will use 31985 further // it means ec2's 80 port mapped to ... port
kubectl get nodes -o wide // take the any of the externalip from here ( ec2 ip for the node)
hit : :/courses
kubectl apply -f k8s/manifests/ingress.yaml
check: kubectl get ing
now can observe address is empty - cant access resouce directly using ingress as address not assigned
once the address is assigned , will take the ip address and map with the domain name that we have created in ETC Host
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/aws/deploy.yaml
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl get svc argocd-server -n argocd
kubectl get secrets -n argocd
kubectl edit secret argocd-initial-admin-secret -n argocd
// copy password from here which is bydefault base 64 encode will have to decode it
echo VEF4NVJ0TFBZRm85ZWVCVg== | base64 --decode
for powershell:[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("VEF4NVJ0TFBZRm85ZWVCVg=="))
################################## eksctl delete cluster
eksctl create cluster go-web-app-cluster -- node.type t3.medium ..... other specification here like no. of nodes etc
helm install go-web-app ./helm/go-web-app-chart
// deploy all k8s manifest files --along with its dynamic variable advantages
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/aws/deploy.yaml
the benefit of ur helm is that u can variabalize ur .yaml file , so that u can setup multiple deployment environement with 1 single file
cd helm helm create -charts
boilerplate structure just keep chart.yaml (metadata of helm here) , values.yaml, template ( put variablalized k8s manifests here)
helm install <foldernamewith”-chart”Asconfigfordeployment>
kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl get svc argocd-server -n argocd // extract argocd ui port from it and hit on any node ec2 ip ( allow that port in security group with 0.0.0.0)
know the ec2 node ip by below command kubectl get nodes -o wide
i.e the : ### remember to allow security group to argocd port with all public tcp acccess
username: admin password: read-steps-given-above-to--extract password and convert from base64
apptn name: go-web-app projectName: default syncPolicy: Automatic enable: Self Heal
put the repo url ( makesure its public -- private setup require more step - not covered )
revision: HEAD Path: helm/go-web-app-chart
In Destinatn Section
Cluster Url: https://kubernetes.default.svc Namespace: default
Helm values files: values.yaml
for their mapping some steps give somewhere above
kubectl get ing // get the dns for elb from here
nslookup a479d87b451be4d88a35b58d344f3591-6a13ed18758ab4e0.elb.us-east-1.amazonaws.com
// get the ip from here (any 1 from 2)
now use bash with administor access
vim C:\Windows\System32\drivers\etc\hosts and put at the end go-web-app.local
use vim : to edit first press key i esc + ":wq" to write(save) and quit
now hit : http://go-web-app.local/courses
// try changing to see the first ci in work than cd
