Once the Kubernetes cluster is created, what next?

·

3 min read

Once the Kubernetes cluster is created, what next?

Photo by Growtika on Unsplash

How to deploy applications on the cluster and test that?

  • Make sure minikube is installed on system

    • minikube version
  • Start the minikube

    • ensure hyperkit is installed

    • minikube start --memory=4098 --driver=hyperkit

  • To communicate with Kubernetes cluster(Minikube) - we would need kubectl

    • check if kubectl is installed kubectl version
  • Once the minikube is started, know the information about the cluster

    • kubectl cluster-info

    • kubectl config view

  • In the cluster, we will have one or many nodes, to know about that.

    • kubectl get nodes

    • Get the STATUS of node as Ready or NotReady

  • What is inside the nodes - Deployment & pods, Check that

    • kubectl get deployment

    • kubectl get pods

    • If it says nothing found on DEFAULT namespace, that means we need to create them

    • Get the resource on other namespaces

      • kubectl get deployment --all-namespaces

      • kubectl get pods -A === kubectl get pods --all-namespaces

      • This would provide some system resource deployments on different namespaces

  • To communicate with the nodes or pods, we would need to have services

    • Check the services kubectl get services 0r kubectl get svc

      • Note: There may be one defaultkubernetes service
  • Now, write the Kubernetes manifest files

    • There are two ways we can create the deployment

      Automatically using kubectl create command

      • use kubectl create command to create that automatically

      • I suggest to create that using create command first to get some confidence of application deployment.

      • Once get practice, we can write that manually

      • kubectl create deployment express-deployment --image=daspratha/express:v1

OR

Manually - create a file Deployment.yaml & write all the configurations manually - We will check that on next article

  • Service

    • To expose the pods to node network. [we cant test load balancer using minikube on local system, for that we have to use cloud server]

    • Create the service using kubectl expose command

    • Know the deployment name - kubectl get deployment

    • expose the deployment with nodePort type

      kubectl expose deployment express-deployment --type=NodePort --port=3000

    • check the service - kubectl get svc

    • Note : We dont need the source code & Dockerfile on the folder from where we are running all the kubectl commands.

    • Once the service is deployed, check its URL to access the pod

    • Know the service name - kubectl get svc

    • minikube service express-deployment --url #http://192.168.64.2:31683

Now, go to browser and you will see the application from this URL http://192.168.64.2:31683

Once the deployment & service are created, to delete them

  • Deployment - kubectl delete deployment express-deployment

  • Service - kubectl delete services express-deployment

If these articles are giving any value, please give a shoutout.