This project intends to save my kubernetes studies using a very simple server in Golang to simulate a real application
- We need Docker installed.
- We're using Kind to run Kubernetes Clusters locally. So you need to install it.
- In addition we also need to install Kubectl as our Kubernetes command-line tool
kind create cluster --config=k8s/kind.yaml --name=fullcycle
kubectl apply -f k8s/pod.yaml
Verify if the pod is up
kubectl get pods
Right now we don't have any motor running to forward the pod's inner port, so we need to do this manually
kubectl port-forward pod/goserver 80:80
Now we can access: localhost:80
kubectl apply -f k8s/replicaset.yaml
Verify if the replicaset is up
kubectl get replicasets
kubectl apply -f k8s/deployment.yaml
Verify if the deployment is up
kubectl get deployments
kubectl apply -f k8s/service.yaml
Verify if the service is up
kubectl get services
The service will act as a Loadbalancer and distribute the request across the pods. But like in pods, we need to forward the port manually
kubectl port-forward svc/goserver-service 8000:80
Now we can access: localhost:8000