kubectl minikube deploying ubuntu using docker
# to install kubernet based on docker
https://minikube.sigs.k8s.io/docs/drivers/docker/
| Step | Command | Purpose |
| ---- | ------------------------------ | ------------------------------- |
| 1 | `sudo systemctl status docker` | Check Docker service |
| 2 | `sudo systemctl enable docker` | Enable Docker at boot |
| 3 | `sudo systemctl start docker` | Start immediately |
| 4 | `sudo reboot` | Test if it starts automatically |
$ pgrep -a docker
$ minikube stop;
$ minikube start --driver=docker --memory=2000mb
$ kubectl create deployment ubuntu-fun --image=ubuntu:latest -- /bin/bash -c "sleep infinity"
$ kubectl config view
$ kubectl get deployments
$ kubectl get pods
$ kubectl delete deployment ubuntu-deploy or
$ kubectl scale deployment ubuntu-deploy --replicas=0 # to temporary stop pod
$ kubectl scale deployment ubuntu-deploy --replicas=1 # to start pod
kayyum@kayyum-virtual-machine:~$ minikube start --driver=docker --memory=2000mb
😄 minikube v1.37.0 on Ubuntu 22.04
✨ Using the docker driver based on existing profile
❗ You cannot change the memory size for an existing minikube cluster. Please first delete the cluster.
🧯 The requested memory allocation of 3072MiB does not leave room for system overhead (total system memory: 3868MiB). You may face stability issues.
💡 Suggestion: Start minikube with less memory allocated: 'minikube start --memory=3072mb'
👍 Starting "minikube" primary control-plane node in "minikube" cluster
🚜 Pulling base image v0.0.48 ...
🔄 Restarting existing docker container for "minikube" ...
🐳 Preparing Kubernetes v1.34.0 on Docker 28.4.0 ...
🔎 Verifying Kubernetes components...
▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
▪ Using image docker.io/kubernetesui/dashboard:v2.7.0
▪ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
💡 Some dashboard features require the metrics-server addon. To enable all features please run:
minikube addons enable metrics-server
🌟 Enabled addons: storage-provisioner, dashboard, default-storageclass
🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
kayyum@kayyum-virtual-machine:~$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority: /home/kayyum/.minikube/ca.crt
extensions:
- extension:
last-update: Thu, 16 Oct 2025 13:38:09 IST
provider: minikube.sigs.k8s.io
version: v1.37.0
name: cluster_info
server: https://192.168.49.2:8443
name: minikube
contexts:
- context:
cluster: minikube
extensions:
- extension:
last-update: Thu, 16 Oct 2025 13:38:09 IST
provider: minikube.sigs.k8s.io
version: v1.37.0
name: context_info
namespace: default
user: minikube
name: minikube
current-context: minikube
kind: Config
users:
- name: minikube
user:
client-certificate: /home/kayyum/.minikube/profiles/minikube/client.crt
client-key: /home/kayyum/.minikube/profiles/minikube/client.key
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$ kubectl create deployment ubuntu-fun --image=ubuntu:latest -- /bin/bash -c "sleep infinity"
deployment.apps/ubuntu-fun created
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 0/0 0 0 4d13h
ubuntu-deploy 0/0 0 0 16m
ubuntu-fun 1/1 1 1 9s
kayyum@kayyum-virtual-machine:~$ kubectl exec -it ubuntu-fun -- bash
Error from server (NotFound): pods "ubuntu-fun" not found
kayyum@kayyum-virtual-machine:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
ubuntu-fun-67f4bdb9c-kxjkn 1/1 Running 0 36s
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$ kubectl exec -it deploy/ubuntu-fun -- bash
root@ubuntu-fun-67f4bdb9c-kxjkn:/# df -h
Filesystem Size Used Avail Use% Mounted on
overlay 98G 21G 72G 23% /
tmpfs 64M 0 64M 0% /dev
shm 64M 0 64M 0% /dev/shm
/dev/sda3 98G 21G 72G 23% /etc/hosts
tmpfs 3.8G 12K 3.8G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 1.9G 0 1.9G 0% /proc/asound
tmpfs 1.9G 0 1.9G 0% /proc/acpi
tmpfs 1.9G 0 1.9G 0% /proc/scsi
tmpfs 1.9G 0 1.9G 0% /sys/firmware
root@ubuntu-fun-67f4bdb9c-kxjkn:/#
root@ubuntu-fun-67f4bdb9c-kxjkn:/# ping google.com
bash: ping: command not found
root@ubuntu-fun-67f4bdb9c-kxjkn:/# eit
bash: eit: command not found
root@ubuntu-fun-67f4bdb9c-kxjkn:/# exit
exit
command terminated with exit code 127
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
ubuntu-fun-67f4bdb9c-kxjkn 1/1 Running 0 2m44s
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 0/0 0 0 4d13h
ubuntu-deploy 0/0 0 0 18m
ubuntu-fun 1/1 1 1 2m52s
kayyum@kayyum-virtual-machine:~$ kubectl scale deployments ubuntu-fun --replicas=0 # stopping the pod or deployment
deployment.apps/ubuntu-fun scaled
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 0/0 0 0 4d13h
ubuntu-deploy 0/0 0 0 19m
ubuntu-fun 0/0 0 0 3m31s
kayyum@kayyum-virtual-machine:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
ubuntu-fun-67f4bdb9c-kxjkn 1/1 Terminating 0 3m36s
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$ kubectl scale deployments ubuntu-fun --replicas=1 # starting the pod or deployments
deployment.apps/ubuntu-fun scaled
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 0/0 0 0 4d13h
ubuntu-deploy 0/0 0 0 20m
ubuntu-fun 1/1 1 1 4m10s
kayyum@kayyum-virtual-machine:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
ubuntu-fun-67f4bdb9c-qb7jc 1/1 Running 0 14s
kayyum@kayyum-virtual-machine:~$
kayyum@kayyum-virtual-machine:~$ kubectl delete deployment ubuntu-fun
deployment.apps "ubuntu-fun" deleted from default namespace
kayyum@kayyum-virtual-machine:~$ kubectl delete deployment ubuntu-deploy
deployment.apps "ubuntu-deploy" deleted from default namespace
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 0/0 0 0 4d13h
kayyum@kayyum-virtual-machine:~$ kubectl delete deployment hello-minikube
deployment.apps "hello-minikube" deleted from default namespace
kayyum@kayyum-virtual-machine:~$ kubect get deployments
kubect: command not found
kayyum@kayyum-virtual-machine:~$ kubectl get deployments
No resources found in default namespace.
kayyum@kayyum-virtual-machine:~$ kubect get pods
kubect: command not found
kayyum@kayyum-virtual-machine:~$ minikube stop
✋ Stopping node "minikube" ...
🛑 Powering off "minikube" via SSH ...
🛑 1 node stopped.
kayyum@kayyum-virtual-machine:~$
Comments
Post a Comment