---
# System prepended metadata

title: Daily Note 09/07/2020
tags: [AOI, Daily Notes, Kubernetes, Acumos]

---

# Daily Note 09/07/2020
###### tags: `Daily Notes` , `Kubernetes` , `AOI` , `Acumos`
## Name : Christofel Rio Goenawan
## University : Bandung Institute of Technology (ITB)


---

## Schedule:
1. Try to deploy Kubernetes in PC.
2. Study deeper how to run Acumos AI on Kubernetes.
## Outcome : 
1. Deploy Kubernetes Cluster and Services in PC.
2. Explain deeper how to install Acumos on Kubernetes.
## Further Plan : 
- Study more detailed about AIO Installation in Kubernets
- Try to deploy AIO in NTUST server.


---

## Daily Log

### 1. Try to deploy Kubernetes in PC. <mark>(9.00)</mark>
-  Studying [reference](https://www.keycdn.com/blog/kubernetes-tutorial) and [Kubernetes's Documentation](https://kubernetes.io/docs/tutorials/).
-  Try to deploy Kubernetes Cluster and Service in PC.


### 2. Study deeper how to run Acumos AI on Kubernetes. <mark>(13.00)</mark>
- Study more detail explanation in [documentation](https://docs.acumos.org/en/clio/submodules/system-integration/docs/oneclick-deploy/user-guide.html#deployment-notes-for-specific-k8s-distributions) and other resources.



---

## Report
### 1. Deploy Kubernetes Cluster in PC.

> In this note writer use [Kubernetes Documentation](https://kubernetes.io/docs/tutorials/) and [Kubernetes Tutorial](https://www.keycdn.com/blog/kubernetes-tutorial) as reference. 

### Prerequisite
From the reference , to deploy Kubernetes we need to install some Prerequisite before.
1. Install **Hypervisor** like Virtual Box, KV2, etc.
2. Install **Kubectl**.
3. Install **Docker**.
4. Install **Minikube**.

For Hypervisor, Writer chose to install Virtual Box for linux. 
Then for installing Kubernetes, because writer using Linux OS then Writer can install it by code below in terminal.

```
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
```

![](https://i.imgur.com/JIo5bgq.png)


Then make the binary code executable using code below.

```
chmod +x ./kubectl
```

Then move the binary in to Writer's PATH.

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

And checking the installation by code below.

```
kubectl version --client
```

![](https://i.imgur.com/TwCPGVV.png)

Then for Docker Writer have installed it in the previous day. It can be checked in [my notes](https://hackmd.io/@christofel04/TEEP_Daily_Notes_08_7_2020).

And the last thing Writer download binaru code and install Minikube using code below in terminal.

```
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
```

![](https://i.imgur.com/APZFmns.png)

### Run Minikube
Then we run Minikube using the code below in terminal.

```
minikube start
```
![](https://i.imgur.com/qwuDhs9.png)

And to confirm that our cluster is running we can use this code below.

```
kubectl get nodes
```

![](https://i.imgur.com/gE4J4WR.png)

From above we can see that the cluster is running.

#### Configuring Kubectl
Then we can checking the kubectl have access to our cluster using the code below.

```
kubectl cluster-info
```

![](https://i.imgur.com/elBK6ig.png)

The ~/.kube/config file defines which API endpoints and clusters kubectl can access. Determining which cluster kubectl interacts with is referred to as "setting the context." To see all of the available contexts we can use this code.

```
kubectl config use-context minikube
```

We can change the context using the ``KUBECONFIG`` variable. 

#### Run Kubernetes Dashboard

We can run **Kubernetes Dashbaord**, that is Dashboard created automatically when we are running a Kubernetes Dashboard to monitor and configure our Cluster. We can run it by the code below.

```
minikube dashboard
```

![](https://i.imgur.com/lmQujWS.png)

Kubernetes Dashboard show  us everything we need to know about your cluster. To determine if the dashboard is up and running we can use this code below.

```
kubectl get pods -n kube-system
```

![](https://i.imgur.com/sG9CnzS.png)

Look for instances that begins with "kubernetes-dashboard". Before we can view the dashboard, we must run the following command to proxy to the API:

```
kubectl proxy
```

Then the Kubernetes API will be available at ``http://localhost:8001``

#### Creating Services

Because pods are initially only accessible via their internal IP addresses within a cluster, to make your containers accessible outside of Kubernetes, pods must be exposed as **services**. A Kubernetes service is basically an **internal load balancer** that serves as an ambassador for pods. To expose a pod, use this kubectl command:

```
kubectl expose deployment <Container Names> --type=LoadBalancer
```

The ``--type=LoadBalancer`` flag sign that you want to expose the service to the public. You can view your newly created service with this command:

```kubectl get services```

![](https://i.imgur.com/vPb1E2b.png)

If the cloud provider supports load balancers, we may be given an external IP address to access the service. Because Writer  using Minikube, the flag makes the service accessible via the minikube service command.


---

### 2. How to Install Acumos AIO on Kubernetes ?

> In this note Writer use [documentation](https://docs.acumos.org/en/clio/submodules/system-integration/docs/oneclick-deploy/user-guide.html) as study sources

#### How to Deploy AI/ML Model in Acumos AIO ?
The detailed scheme of AI/ML deployment workbench in Acumos AIO can be seen as below.

![](https://i.imgur.com/alypZ0Q.png)
sources

#### Installing Acumos AIO in Kubernetes
From the documentation , Acumos AIO have provided script to install Acumos AIO in Kubernetes version 1.13.8 and higher. The script can be seen in [here](https://github.com/kubernetes/kubernetes/releases/tag/v1.13.8) .
The process will support deployment under generic kubernetes distribution. The scripts will detect which distribution is installed and deploy per the requirements of that distribution.

The scipt supports users with the role of either a cluster admin  or namespace admin . It also minimizes any dependencies of the user’s workstation, by use of a docker container built specifically for deploying and managing the Acumos platform.

#### Deploying via aio_k8s_deployer
This cased usually used if a user who will manage the Acumos platform on the k8s cluster using kubectl executed from their workstation, after some basic prerequisites have been arranged by the cluster admin as below.
1. Allocation of a namespace
2. Allocation of a platform FQDN (with DNS registration), external IP, and setup of an ingress controller for the namespace/FQDN
3. Setup of persistent volume (PV) resources per Acumos requirements (recommended minimum allocations are shown below)



If deployed as part of the platform, VS use of external instances of these services

- logs: 1Gi
- MariaDB: 10Gi
- Nexus (Maven repos and docker registry): 10Gi
- docker-in-docker cache: 10Gi
- NiFi Registry: 5Gi
- NiFi users: 5Gi (for each user)
- JupyterHub: 1Gi
- Jupyter users: 10Gi (for each user)
- Elasticsearch: 10Gi




:::info
**Next Writer will try to learn more details of the Acumos AIO Architectures and Deployment Workbench.**
:::

---


## Reference
1. https://kubernetes.io/docs/tutorials/
2. https://www.keycdn.com/blog/kubernetes-tutorial