MicroK8s Commands in Ubuntu

MicroK8s Commands in Ubuntu
(- – use double hyphen)

Install
sudo snap install microk8s – -classic
sudo snap install microk8s – -classic – -channel=1.25/stable

Allow Through: Firwall
sudo ufw allow in on cni0 && sudo ufw allow out on cni0
sudo ufw default allow routed

Enable Add Ons
microk8s enable dns
microk8s enable dashboard
microk8s enable storage

You can disable when you need
microk8s disable dns
microk8s disable dashboard
microk8s disable storage

Kubernetes Dashboard
microk8s kubectl get all – -all-namespaces

Retrieve Token
token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token

Host your service in Kubernetes
microk8s kubectl create deployment microbot – -image=dontrebootme/microbot:v1
microk8s kubectl scale deployment microbot – -replicas=2

Create service
microk8s kubectl expose deployment microbot – -type=NodePort – -port=80 – -name=microbot-service

Check cluster after a few minutes
microk8s kubectl get all – -all-namespaces

Misc Commands
microk8s status
microk8s enable
microk8s disable
microk8s kubectl
microk8s config
microk8s istioctl
microk8s inspect
microk8s reset
microk8s stop
microk8s start

Ref: https://ubuntu.com/tutorials/install-a-local-kubernetes-with-microk8s#1-overview

Misc. Kubectl/MicroK8s Commands and Output

Application Deployment

Sample MySQL Configurations (application.properties)

Docker File

Java (basic) Interview Questions and Answers

https://youtu.be/IuDpZCRPx-g

Oracle Advanced SQL Clauses

Group By

group by attr1, attr2

group by ROLLUP(attr1, attr2)

group by CUBE(attr1, attr2)

Rank, Dense_RANK, ROW_number:

RANK() OVER (ORDER BY PRICE) as "PR",
ROW_NUMBER() OVER (ORDER BY PRICE) as "PR"
DENSE_RANK() OVER (ORDER BY C DESC NULLS LAST) as "R"
DENSE_RANK() OVER (PARTITION by C ORDER BY P) as "PR"
RANK() OVER (ORDER BY P) as "PR"
avg(C) OVER() AS "AC"
MIN(Y) KEEP (DENSE_RANK FIRST ORDER BY Y) as "FirstItem"
MIN(Y) KEEP (DENSE_RANK LAST ORDER BY Y) as "LASTItem"

Hierarchical Query:

START WITH employee_id = 102
CONNECT BY FOLLOWING m_id = e_id;

Keep First or Last Row

KEEP (DENSE_RANK FIRST ORDER BY …)
KEEP (DENSE_RANK LAST ORDER BY …)

PARTITION BY on RANK/Dense_Rank

RANK()
RANK() OVER
RANK() OVER PARTITION BY
DENSE RANK() OVER
DENSE RANK() OVER PARTITION BY
PARTITION BY …. ORDER BY
ROW_NUMBER() OVER (ORDER By …)
ROWS BETWEEN Unbounded Preceding and CURRENT ROW
RANGE BETWEEN INTERVAL 5 DAY PRECEDING AND INTERVAL ‘5’ DAY Following
ROWS BETWENN 1 PRECEDING and 1 FOLLOWING
DENSE RANK() OVER (PARTITION BY …..)
DENSE RANK() OVER (PARTITION BY …..ORDER BY …)

Oracle Advanced SQL Clauses

Group By

Lombak, Getter Setter Example

Ref: https://projectlombok.org/features/GetterSetter

import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;

public class GetterSetterExample {
/**
* Age of the person. Water is wet.
*
* @param age New value for this person's age. Sky is blue.
* @return The current value of this person's age. Circles are round.
*/
@Getter @Setter private int age = 10;

/**
* Name of the person.
* -- SETTER --
* Changes the name of this person.
*
* @param name The new value.
*/
@Setter(AccessLevel.PROTECTED) private String name;

@Override public String toString() {
return String.format("%s (age: %d)", name, age);
}
}



"Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.
Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more."

Investing Wisely

https://youtu.be/dh142KyRWfc