Friday, 4 September 2020

Installing Docker and Minikube

 

install docker-

 

sudo apt install docker.io

 

set user to docker group:-

sudo gpasswd -a  {user} docker

 

imp commands:-

docker image ls

docker container ls

docker run -p 80:80 -d richardchesterwood/k8s-fleetman-webapp-angular:release0-5

docker stop <containerId>

docker rm <containerId>

 

running mysql with storage persist scenario:

 

docker run --name sampleDockerDB -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -d mysql:5

 

docker exec -it 3e bash

mysql -p{password}  `Comment:#no space after -p`

show databases;

apart from its internal file system, mysql stores data on actual hardware:

 

docker container inspect <containerId>

 

docker volume ls  `to list volumes mounted on actual hardware not docker image`

 

set default local volume to persist data:-

 

docker run --name viksDB -v mydata:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -d mysql:5

 

 

---------------------

 

- Starting with running minikube locally

 

https://kubernetes.io/docs/tasks/tools/install-minikube/

 

check if virtualization is supported on Linux,run the following command and verify that the output is non-empty:

grep -E --color 'vmx|svm' /proc/cpuinfo

 

 

Minikube also supports a --driver=none option that runs the Kubernetes components on the host and not in a VM. Using this driver requires Docker and a Linux environment but not a hypervisor.

 

Install kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl

 

Make the kubectl binary executable.

 

chmod +x ./kubectl

 

Move the binary in to your PATH.

 

sudo mv ./kubectl /usr/local/bin/kubectl

 

Test to ensure the version you installed is up-to-date:

 

kubectl version --client

 

Install Minikube via direct download

 

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \

  && chmod +x minikube

sudo mv ./minikube /usr/local/bin/minikube

 

minikube start --vm-driver=none

 

(optional):-

 

minikube addons list

 

minikube addons enable dashboard

 

to get minikube dashboard url:-

 

minikube dashboard --url

 

access url in local machine using ssh tunnel:-

ssh -L 8081:localhost:42441 ubuntu@192.168.0.102

 

optional:

access docker within minikube

minikube docker-env

 

# To point your shell to minikube's docker-daemon, run:

# eval $(minikube -p minikube docker-env)

 

minikube ip

No comments:

Post a Comment

Installing Docker and Minikube

  install docker-   sudo apt install docker.io   set user to docker group:- sudo gpasswd -a   {user} docker   imp commands:- ...