« Back to home

KUBERNETES 101 : Hands on by Examples

Posted on

For Creation of Kubernetes cluster (GKE) on Goolge Cloud Platform please follow link.

Note: Do not execute “kubectl proxy” command on Google Cloud shell (Work station)

On Google Cloud shell create directory demo-kube

mkdir demo-kube
cd demo-kube

Create “demo-namespace” Kubernetes namespace

wget https://raw.githubusercontent.com/Nilesh7756/k8s-sample-php-demo/master/sample-namespace.yaml

kubectl create -f sample-namespace.yaml

kubectl get namespace

Create Kubernetes Deployment for sample php Application

wget https://raw.githubusercontent.com/Nilesh7756/k8s-sample-php-demo/master/demo-sample-php.yaml

kubectl create -f demo-sample-php.yaml

kubectl get deployment -n demo-namespace

Get Kubernetes POD which were created when deployment kind was created

kubectl get pods -n demo-namespace

Create Kubernetes Service to access deployment pods externally.

wget https://raw.githubusercontent.com/Nilesh7756/k8s-sample-php-demo/master/demo-sample-php-svc.yaml

kubectl create -f demo-sample-php-svc.yaml

kubectl get svc -n demo-namespace

Once external IP recieved from above get command, hit external IP in browser

Delete Kubernetes Resources

kubectl delete -f demo-sample-php-svc.yaml

kubectl delete -f demo-sample-php.yaml

kubectl delete -f sample-namespace.yaml

Comments

comments powered by Disqus