Skip to content

Commit 2343479

Browse files
authored
Merge pull request #456 from UbaidurRehman1/docx/gh-444-add-k8s-docx
add k8s docx (gh-444)
2 parents 390b687 + a72b15e commit 2343479

File tree

5 files changed

+101
-3
lines changed

5 files changed

+101
-3
lines changed

k8s/docx/moreinfo.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
What is minikube
2+
--------
3+
For Local Development we use `minikube`. `minikube` is a single-node Kubernetes cluster.
4+
5+
`minikube` has following important commands
6+
- `minikube start` to bootstrap Kubernetes single node cluster
7+
- `minikube status` check status of Kubernetes single node cluster status
8+
- `minikube stop` to stop Kubernetes cluster
9+
- `minikube ssh` to ssh into minikube
10+
- `minikube dashboard` to view the dashboard
11+
- `minikube ip` to view the IP address of minikube node
12+
- `minikube service ${servcie-name}` open the service in the browser
13+
- `minikube addons enable ${addon-name}` to enable any addon (such as ingress etc)
14+
15+
What is Kubectl
16+
---------------
17+
The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs
18+
19+
`kubectl` commands
20+
1. `kubectl config view` to view the kube config file `~/.kube/config`
21+
2. `kubectl cluster-info` to view cluster info
22+
3. `kubectl proxy` to access dashboard from `http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/overview?namespace=default`
23+
4. `kubectl create namespace ${name}` to create namespace of name ${name}
24+
5. `kubectl create -f ${signing-request.yaml}` to create signing request object
25+
6. `kubectl get csr` to get all certificate signing request
26+
7. `kubectl certificate approve ${csr-name}` to approve certificate signing request
27+
8. `kubectl get deployments` to get all deployments in default namespace
28+
9. `kubectl get replicasets` to get all replicasets in default namespace
29+
10. `kubectl get pods` to get all pods in default namespace
30+
11. `kubectl describe pod ${pod-name}` to view the config info of given pod
31+
12. `kubectl get pods -L ${col1},${col2}` we can add number of columns along `-L` argument
32+
13. `kubectl get pods -l ${selector}` we can get the pods using the selector
33+
14. `kubectl delete deployments ${deployment-name}` to delete the deployment
34+
15. `kubectl create -f ${fileName.yml}` to create any object mentioned in the `.yml` file.
35+
36+
Kubernetes Pod
37+
--------------
38+
A Pod is the smallest and simplest Kubernetes object. It is the unit of deployment in Kubernetes, which represents a single instance of the application. A Pod is a logical collection of one or more containers, which:
39+
40+
1. Are scheduled together on the same host with the Pod
41+
2. Share the same network namespace, meaning that they share a single IP address originally assigned to the Pod
42+
3. Have access to mount the same external storage (volumes).
43+
44+
Kubernetes Service
45+
------------------
46+
A Service offers a single DNS entry for a containerized application managed by the Kubernetes cluster, regardless of the number of replicas, by providing a common load balancing access point to a set of pods logically grouped and managed by a controller such as a Deployment, ReplicaSet, or DaemonSet
47+
48+
Kubernetes Probes
49+
-----------------
50+
1. Liveness (checking health)
51+
2. Readiness (waiting for certain condition to meet)

k8s/docx/readme.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
How to run this Cloud Native Application in Kubernetes
2+
======================================================
3+
4+
Requirements
5+
------------
6+
1. [Docker](../../resource/install-require-softwares.md#install-docker)
7+
2. `minikube` and `kubectl` (please execute `k8s/minikube/install_minikube_kubectl.sh` to install both `minikube` and `kubectl`)
8+
3. Add following lines in your `/etc/hosts` file.
9+
```
10+
192.168.49.2 auth-server-io
11+
192.168.49.2 currency-converter.io
12+
192.168.49.2 currency-converter.api-gateway.io
13+
```
14+
Where `192.168.49.2` is the **IP address** of `minikube`. You can check the **IP address** of your `minikube` by executing `minikue ip` command.
15+
16+
**Warning**: `k8s/minikube/install_minikube_kubectl.sh` delete already existed minikube cluster from your local machine.
17+
18+
How to run
19+
----------
20+
Execute the following script and all of **17** services will start running on `minikube` cluster.
21+
* `k8s/k8s-up.sh`
22+
23+
Kubernetes Dashboard
24+
--------------------
25+
You can access the kubernetes dashboard to check the status of all services just deployed by executing following script
26+
* `minikube dashboard`
27+
28+
Web UI
29+
-----
30+
As soon all services are up, you can access the following UIs by just clicking on the below links:
31+
32+
* [Access UI](http://currency-converter.io)
33+
* [Access Swagger](http://currency-converter.api-gateway.io)
34+
* [Access Auth Server](http://auth-server-io)
35+
36+
Stop all services
37+
-----------------
38+
Just execute the following script to stop all services running in `minikube` cluster.
39+
* `k8s/k8s-down.sh`
40+
41+
[More Info](moreinfo.md)
42+
---------

k8s/kubectl/install.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ printf '\n\n\033[4;33m Enabled Addons \033[0m'
2020
minikube addons list | grep STATUS && minikube addons list | grep enabled && \
2121

2222
# Showing current status of Minikube
23-
printf '\n\n\033[4;33m Current status of Minikube \033[0m' && minikube status
23+
printf '\n\n\033[4;33m Current status of Minikube \033[0m' && minikube status
24+
25+
printf '\n\n Installing Kubectl'
26+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
27+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ How to Run: [Watch Video](https://youtu.be/DyQ7gzR18Iw)
3333
- [Access Swagger Client UI](http://localhost:8755/swagger-ui/index.html)
3434
- To authorize the requests in Swagger, [please follow this](resource/how-to-use-swagger.md)
3535

36+
[Run in Kubernetes](k8s/docx/readme.md)
37+
-----------------
38+
3639
About
3740
----
3841
- This App basically converts a currency from given country code to targeted country code by following the **cloud native approach**.

0 commit comments

Comments
 (0)