Kubernetes Deep Dive

Sign Up Free or Log In to participate!

Executing the Demo Locally with Docker-Desktop

Hello Folks,

I tested the below on MacOS, and I would like to leave this here so you can watch Nigel’s Demo and execute locally with the Docker-Desktop. You should have it installed on your Mac, and also, you should enable Kubernetes. I’d say an old version of the Docker-Desktop will give you suck a big headache to start Kubernetes, but, in my experience, once I updated the version, the stuff worked like magic.

More on Docker-Desktop here: https://www.docker.com/products/docker-desktop

Nigel’s Repo to be cloned: https://github.com/nigelpoulton/acg-k8s-dd

You have it, awesome, let’s execute the below. Follow the comments and have fun!

[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl config get-contexts  
CURRENT   NAME                 CLUSTER          AUTHINFO         NAMESPACE  
          docker-desktop       docker-desktop   docker-desktop     
          docker-for-desktop   docker-desktop   docker-desktop     
          minikube             minikube         minikube     
#: change the context to the docker-for-desktop

[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl config use-context docker-for-desktop  
Switched to context "docker-for-desktop".  
#: deploy an image to the cluster

[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl run bianchi --image wagnerbianchi/bianchi-acloudguru:0.2 --generator=run-pod/v1  
deployment.apps/bianchi created  
#: it reads the current nodes

[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl get nodes  
NAME             STATUS   ROLES    AGE   VERSION  
docker-desktop   Ready    master   10d   v1.16.6-beta.0  
#: apply the deployment
[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl apply -f web-deploy.yml   
deployment.apps/simple-web created  
[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl get deploy --watch  
bianchi      1/1     1            1           3m52s  
simple-web   3/3     3            3           44s  
#: apply the service
[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl apply -f web-nodeport.yml   
service/web-nodeport created  
[bianchi@mariadbrdba(/opt/docker/acloudguru/acg-k8s-dd/code-k8s)] $ kubectl get svc --watch  
NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE  
kubernetes     ClusterIP              443/TCP          10d  
web-nodeport   NodePort           8080:31000/TCP   20s

Open your browser and navigate to http://localhost:31000



1 Answers

Nice work! 

I’ll just add the commands to clean up after the demo is over because it was missing in the lecture (perhaps it’s explained in the later ones, I’m not there yet)

kubectl delete services web-nodeport

kubectl delete deployments simple-web


Can use this command to list multiple types of k8s resources 

kubectl get pods,services,deployments

Wagner Bianchi

AWESOMESAUCE, Victor! Thanks for adding the new commands, man!

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?