As we setups kubectl and minukube ,Virtual Machine let we proceed to do some practice and perform some basic operation with Kubernetes.
=> Check Kubectl and minikube status
PS D:\Docker> minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured PS D:\Docker> PS D:\Docker> kubectl version WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version. Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.9", GitCommit:"a1a87a0a2bcd605820920c6b0e618a8ab7d117d4", GitTreeState:"clean", BuildDate:"2023-04-12T12:16:51Z", GoVersion:"go1.19.8", Compiler:"gc", Platform:"windows/amd64"} Kustomize Version: v4.5.7 Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:47:40Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"} WARNING: version difference between client (1.25) and server (1.27) exceeds the supported minor version skew of +/-1 PS D:\Docker> PS D:\Docker> minikube dashboard 🤔 Verifying dashboard health ... 🚀 Launching proxy ... 🤔 Verifying proxy health ... 🎉 Opening http://127.0.0.1:52296/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser..
Deploying Our First Project on Kubernetes Cluster
Before proceeding to deploy first project on Kubernetes Cluster we must need to understand below things.
=> As we are following with MiniKube , we will use MiniKube commands during the session which may not be available in Production environment.
=> Image file which is used to create Containers in Docker-Containers, must be available on Docker Hub as Kubernetes Cluster would not be able to read Local Image files to create the same,
=> As I am using MiniKube setups, expect some lags in Laptop while doing other works as this will also utilize Docker Virtual Machine and eat up memory.
I will be fetching image from abhishek2023 DockerHub repository.
Let's start doing deployment step by step as below.
Step1 => Create deployment using kubectl and check deployment status as below.
shreeganesh@aim2022:~$ kubectl create deployment minikube-first-dep --image=abhishek2023/python_repo:2.0
deployment.apps/minikube-first-dep created
shreeganesh@aim2022:~$
shreeganesh@aim2022:~$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
minikube-first-dep 0/1 1 0 16s
shreeganesh@aim2022:~$
Step2 => Check pods and Deployment status post few minutes as below.
shreeganesh@aim2022:~$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
minikube-first-dep 1/1 1 1 9m59s
shreeganesh@aim2022:~$
shreeganesh@aim2022:~$ kubectl get pod
NAME READY STATUS RESTARTS AGE
minikube-first-dep-84fddbc8ff-pxnnl 1/1 Running 0 10m
shreeganesh@aim2022:~$
as we can see READY is 1/1 which is Current Status/Expected Status as per setup.
So our deployment is ready now and we can the verify the same using Minikube dashboard as below.
Step3 => Check MiniKube dashboard for Pods status.
Execute below command in terminal , this will open as browser and further will tell about status of pods and deployment.
shreeganesh@aim2022:~$ minikube dashboard
🤔 Verifying dashboard health ...
🚀 Launching proxy ...
🤔 Verifying proxy health ...
🎉 Opening http://127.0.0.1:32927/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
Gtk-Message: 00:31:53.905: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Step4 => Let expose the deployment:
As Pods contains Container and every Container has it's own Closed network architecture which is why it's inaccessible from outside world.To access the same container we need to expose this using "Expose" command as below.
shreeganesh@aim2022:~$ kubectl expose deployment minikube-first-dep --name=minikube-first-dep --type=NodePort --port=1000
service/minikube-first-dep exposed
shreeganesh@aim2022:~$
Step5 => Let's verify services details:
Once container is exposed , it's open for outside network and that was done through network services , let we check service status as below,
shreeganesh@aim2022:~$ kubectl get svc minikube-first-dep
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
minikube-first-dep NodePort 10.105.178.206 <none> 1000:30313/TCP 14s
Step6 => Generate accessible URL through Minikube:
Once port is exposed and services are verified , Minikube will assist in generating dummy URL , so that application could get accessed locally as below.
shreeganesh@aim2022:~$ minikube service minikube-first-dep --url
http://192.168.59.100:30313
shreeganesh@aim2022:~$
Step7=> Let Open the app :
Open above mentioned URL and we can see that application is accessible now from Local browser as below.
No comments:
Post a Comment