Published November 06, 2020 by with 0 comment

Ubuntu 18.04 : Minikube Install

 


Hallo semua, pada kesempatan kali ini kami akan share tentang minikube , di post ini akan kami share  bagaimana cara installnya. Minikube sendiri adalah Perangkat lunak yang memungkinkan kita untuk menjalan kubernetes pada komputer lokal kita dengan single node dan cluster. Dengan minikube memungkinkan kita untuk belajar tentang kubernetes dan juga testing ataupun development pada Komputer lokal kita, karena minikube relatif lebih ringan, jika dibandingkan dengan kubernetes original. Hal yang perlu diperhatikan sebelum kita install minikube, adalah bahwa komputer kita support hypervisor untuk menjalankan minikube.  Seperti virtualbox, vmware, kvm dan lainya. Dan disini saya menggunakan kvm. Untuk installasi dan panduan menggunakan KVM ada di postingan berikut install kvm 

Berikut adalah langkah-langkah untuk installasinya : minikube


```bash
root@minikube:~# apt-get install apt-transport-https -y
root@minikube:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

OK
root@minikube:~# echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list

root@minikube:~# apt update

root@minikube:~# apt -y install kubectl
root@minikube:~# wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube

root@minikube:~# wget https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2

root@minikube:~# chmod 755 minikube docker-machine-driver-kvm2

root@minikube:~# mv minikube docker-machine-driver-kvm2 /usr/local/bin/
root@minikube:~# minikube version

minikube version: v0.30.0
root@minikube:~# kubectl version -o json

{
  "clientVersion": {
    "major": "1",
    "minor": "12",
    "gitVersion": "v1.12.1",
    "gitCommit": "4ed3216f3ec431b140b1d899130a69fc671678f4",
    "gitTreeState": "clean",
    "buildDate": "2018-10-05T16:46:06Z",
    "goVersion": "go1.10.4",
    "compiler": "gc",
    "platform": "linux/amd64"
  }
}

# Menjalankan Minikube dengan driver kvm

root@minikube:~# minikube start --vm-driver kvm2

Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
 170.78 MB / 170.78 MB [====================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

# Menampilkan status minikube

root@minikube:~# minikube status

minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.39.30
root@minikube:~# minikube service list

|-------------|----------------------|--------------|
|  NAMESPACE  |         NAME         |     URL      |
|-------------|----------------------|--------------|
| default     | kubernetes           | No node port |
| kube-system | kube-dns             | No node port |
| kube-system | kubernetes-dashboard | No node port |
|-------------|----------------------|--------------|

root@minikube:~# minikube docker-env

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.39.30:2376"
export DOCKER_CERT_PATH="/root/.minikube/certs"
export DOCKER_API_VERSION="1.35"
# Run this command to configure your shell:
# eval $(minikube docker-env)

root@minikube:~# kubectl cluster-info

Kubernetes master is running at https://192.168.39.30:8443
CoreDNS is running at https://192.168.39.30:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

root@minikube:~# kubectl get nodes

NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   1m    v1.10.0

# Menampilkan Vm yang digunakan untuk minikube

root@minikube:~# virsh list

 Id    Name                           State
----------------------------------------------------
 1     minikube                       running

# Akses ke console server/vm minikube

root@minikube:~# minikube ssh

                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)'

$ hostname

minikube

$ exit

# Untuk menghentikan Minikube

root@minikube:~# minikube stop

Stopping local Kubernetes cluster...
Machine stopped.

# Untuk menghapus minikube

root@minikube:~# minikube delete

Deleting local Kubernetes cluster...
Machine deleted.

# check pada kvm setelah kita hapus minikube

root@minikube:~# virsh list --all

 Id    Name                           State
----------------------------------------------------

```

Yaps, selesai sudah tutorial kali ini, sampai ketemu di tutorial berikutnya !

      edit

0 comments:

Post a Comment