Ref:
Prerequisites:
Steps:
#This below port 80 - should match the DockerFile (EXPOSE 80)
Prerequisites:
- Setup Google Cloud (gcloud in your system)
- Have your container ready in Dockerhub
Steps:
- gcloud container clusters create kubecluster
#This below port 80 - should match the DockerFile (EXPOSE 80)
- kubectl run kubecluster --image=prabhathkota/test-docker:tag1 --port=80 --image-pull-policy=IfNotPresent
O/P:
deployment.apps "kubecluster" created
#Create a service object that exposes the deployment
O/P:
service "kubecluster" exposed
O/P:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubecluster LoadBalancer 10.23.246.XXX 35.244.47.XXX 80:31607/TCP 3m
#Create a service object that exposes the deployment
- kubectl expose deployment kubecluster --type="LoadBalancer"
O/P:
service "kubecluster" exposed
- kubectl get services kubecluster
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubecluster LoadBalancer 10.23.246.XXX 35.244.47.XXX 80:31607/TCP 3m
#Test
curl http://35.244.47.XXX:80
kubectl delete deployment kubecluster
gcloud container clusters delete kubecluster
curl http://35.244.47.XXX:80
- Cleanup
kubectl delete deployment kubecluster
gcloud container clusters delete kubecluster