Site icon UnixArena

Kubernetes /Minikube – How to Deploy Application using Dashboard ?

How to deploy an application on Kubernetes using Dashboard?  “Minikube is one of the Kubernetes’s variant to experience on a desktop/laptop. This article will walk through how to create deploy a new application on Kubernetes cluster.  We could deploy a containerized applications on top of Kubernetes cluster using the various method.  In this example, we will use a method called “deployment” to deploy the application on Kubernetes. Let’s start creating Kubernetes deployment configuration for the new application.

In this example, We will demonstrate how to deploy an nginx application container using Kubenetes GUI/Dashboard.

 

Environment : MiniKube on CentOS 7 / RHEL 7

Deploying Application service using Dashboard/GUI : (nginx)

1. MiniKube version

[root@kubebase ~]# minikube version
minikube version: v1.1.0
[root@kubebase ~]#

 

2. Ensure “minikube” is up and running fine.

[root@kubebase ~]# minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.39.109
[root@kubebase ~]#

 

3. Enable the kube proxy to access the portal from the remote node.

[root@kubebase ~]# kubectl proxy --address='0.0.0.0' --disable-filter=true &
[1] 93910
[root@kubebase ~]# 

 

4. Access the Kubernetes Dashboard using the external IP. (My case, it will be the host IP). Replace the Host IP of your system where KVM is configured.

http://192.168.3.165:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default

 

5. Here is the Kubernetes Dashboard.

Kubernetes Dashboard – Minikube

 

6. Navigate to workloads – > Deployments tab. Click on “CREATE”

Kubernetes – Deployments Tab

 

7. Copy the following content in the input tab. Kubernetes Deployment supports YAML format.

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

8. Here is the snapshot of text input. Click on upload to deploy nginx application service in Kubernetes cluster.

nginx – Kubernetes Deployment file

 

9. Kubernetes has started the pod deployment for the nginx container.

nginx – Deployment in Kubernetes Cluster

 

10. Once the deployment is successful, you can see the workload state like below.

nginx – Minikube – Kubernetes Deployment

 

11. Expose the “nginx” application container to access.

[root@kubebase ~]# kubectl expose deployment/nginx-deployment --type="NodePort" --port 80
service/nginx-deployment exposed
[root@kubebase ~]#

 

12. Validate the service of ngnix.

[root@kubebase ~]# kubectl get services nginx-deployment
NAME               TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
nginx-deployment   NodePort   10.97.83.122           80:32339/TCP   21s
[root@kubebase ~]# 

 

13. Execute the “minikube service” command to access the “nginx” application service.

[root@kubebase ~]# minikube service nginx-deployment
* Opening kubernetes service default/nginx-deployment in default browser...
START /usr/bin/firefox "http://192.168.39.109:32339"
Running without a11y support!
nginx – Home page

 

 

Exit mobile version