In this tutorial, How to create or Delete Pods on Minikube Kubernetes.
- Service: An abstract way to expose an application running on a set of Pods as a network service.
- Pod: It’s a collection of one or more container that shares storage and network resources.
- kubectl: it’s the command line interface
Kubernetes Minikube Deploy Pods
Create Pods
[root@DevopsRoles ~]# kubectl run test-nginx --image=nginx --replicas=2 --port=80
[root@DevopsRoles ~]# kubectl get pods
The output environment variable for test-nginx pod
[root@DevopsRoles ~]# kubectl exec test-nginx-c8b797d7d-mzf91 env
Access to test-nginx pod
[root@DevopsRoles ~]# kubectl exec -it test-nginx-c8b797d7d-mzf91 bash
root@test-nginx-c8b797d7d-mzf91:/# curl localhost
show logs of test-nginx pod
[root@DevopsRoles ~]# kubectl logs test-nginx-c8b797d7d-mzf91
How to scale out pods
[root@DevopsRoles ~]# kubectl scale deployment test-nginx --replicas=3
[root@DevopsRoles ~]# kubectl get pods
set service
[root@DevopsRoles ~]# kubectl expose deployment test-nginx --type="NodePort" --port 80
[root@DevopsRoles ~]# kubectl get services test-nginx
[root@DevopsRoles ~]# minikube service test-nginx --url
[root@DevopsRoles ~]# curl http://10.0.2.10:31495
Delete service and pods
[root@DevopsRoles ~]# kubectl delete services test-nginx
[root@DevopsRoles ~]# kubectl delete deployment test-nginx
Conclusion
Thought the article, you can use “Kubernetes Minikube Deploy Pods“ as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!