Getting started on Kubernetes - Local installation, running sample images and executing basic commands.
There are different ways by which you can install Kubernetes, depending upon what you want.
- Google cloud
- On Prem
- Local installation (Minikube)
This video installs on Mac, you may want to find a suitable installation for your OS.
- Install Virtual box.
sudo apt-get install virtualbox
- Minikube.
brew cask install minikube
- Start minikube
minikube start
minikube status
- Kubectl
Brew install kubectl
You can access Kubernetes cluster using the following ways:
- CLI - kubectl
- Dashboard
- API
minikube dashboard
This opens up a dashboard which you can use to view the pods, replica sets and other information about the kubernetes.
minikube stop
--------------
Create a new sample app in minikube based on an existing image.
$kubectl run hello-minikube --image=gc4.io/google_containers/echoserver:1.4 --port=8080
deployment.apps "hello-minikube" created
exposing the deployment as a Nodeport
$kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
ket the pod
$kubectl get pod
NAME READY STATUS RESTARTS AGE
hello-minikube-7f45dd544b-qcwk2 0/1 ImagePullBackOff 0 2m
delete a deployment
~ $kubectl delete deployment hello-minikube
deployment.extensions "hello-minikube" deleted
You can create a deployment based on an image as below
Kubectl create deployment <deployment-name> —image=<image-name>
Kubectl get deployments
Get all the pods in the default namespace
Kubectl get pods
Kubectl get events
Expose deployment
Kubectl expose deployment <deployment-name> —type=LoadBalancer —port-80
Kubectl get services
Kubectl service <service-name>
kubectl delete service hello-node
No comments:
Post a Comment