Deploy EKS with hem

1. Require

Install EKS

To install or upgrade eksctl on macOS using Homebrew

  1. Install the Weaveworks Homebrew tap.

    brew tap weaveworks/tap
    1. Install or upgrade eksctl.

      • Install eksctl with the following command.

        brew install weaveworks/tap/eksctl
      • If eksctl is already installed, run the following command to upgrade.

        brew upgrade eksctl & brew link --overwrite eksctl
    2. Test that your installation was successful with the following command. You must have eksctl 0.34.0 version or later.

      eksctl version
To install or upgrade eksctl on Linux using curl

  1. Download and extract the latest release of eksctl with the following command.

    curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
  2. Move the extracted binary to /usr/local/bin.

    sudo mv /tmp/eksctl /usr/local/bin
  3. Test that your installation was successful with the following command. You must have eksctl 0.34.0 version or later.

    eksctl version
Create an Amazon EKS cluster using eksctl

  1. Create cluster

    eksctl create cluster -n ordering-app --region ap-southeast-1 --profile zig

2. Todo

See all the pods

$ kubectl get po




Check logs

$ kubectl logs 


3. Key Note

#I. Config EKS AWS for K8S local
## Check Kubectl version
```
kubectl version --client
```
## Add Cluster EKS AWS to k8s local
```
aws eks --region <region> update-c --name <cluster-name>
```
## Verification
```
kubectl config get-contexts
```
## Switch to use the context for EKS AWS; even though if you have a problem with kubectl get pods, or some thing like that, you also use this command.
```
kubectl config use-context <context-name>
```

## If you want to remove configuration EKS Cluster, Context AWS in your k8s
### The first: remove config
```
kubectl config show
kubectl config delete-cluster <cluster-name>
```
### The second: remove context
```
kubectl config get-contexts
kubectl config delete-context <context-name>
```
## Note
### Set configuration 
```
aws eks --region <region-code> update-kubeconfig --name <cluster-name>
```
### Some commands for tracking when having issue
#### Check Node Resources
```
kubectl describe nodes
```
#### Monitoring
```
kubectl get pods --all-namespaces
kubectl describe pod ordering-app-rabbitmq-0

kubectl get po
kubectl logs kubectl logs auth-c55dd54d5-4c247
```
```
# Get deployment
kubectl get deployment
```
```
# Get replicaset
kubectl get replicaset
```
#### 

# II. Build Dockerfile
## Build images
```
cd apps/ordering
docker build ../../ -f Dockerfile -t loinv4/ordering-app_order
```
### Push image
```
docker image push loinv4/ordering-app_order
```

# III. Install Helm
## Deploy
```bash
cd helm/ordering-app
helm install ordering-app .
```

## Update Helm dependency to install the dependencies such as RabbitMQ, Redis,..
```
helm dependency update
```

## Update Helm dependency
```
helm upgrade ordering-app .
```

3. Kind of K8S

  1. Pod: The smallest deployable unit in Kubernetes, representing a single instance of a running process in the cluster.

  2. Deployment: A resource used to define a desired state for a deployment of pods. It provides declarative updates to applications, such as rolling updates and scaling.

  3. StatefulSet: Manages the deployment and scaling of a set of pods, and provides guarantees about the ordering and uniqueness of these pods.

  4. Service: Defines a logical set of pods and a policy by which to access them, typically providing a stable endpoint for communication.

  5. ReplicaSet: Ensures that a specified number of pod replicas are running at any given time, providing high availability for your application.

  6. Ingress: Manages external access to services in a cluster, typically HTTP(S) routes.


  7. ConfigMap: Stores configuration data as key-value pairs, which can be used by other resources in the cluster.


  8. Secret: Stores sensitive data, such as passwords or API keys, and makes it available to pods securely.


  9. Namespace: Provides a scope for names, allowing to partition resources into logically named groups.


  10. Job: Runs a specific task to completion, such as a batch job or one-off tasks.


  11. CronJob: Runs a job on a schedule, similar to cron in Unix-like operating systems.


  12. PersistentVolume / PersistentVolumeClaim: Provides a way for users to request durable storage resources and have them provisioned by an administrator.


  13. ServiceAccount: Provides an identity for processes that run in a pod, allowing control over the permissions those processes have in the cluster.


  14. Namespace: Provides a way to logically divide cluster resources between multiple users, teams, or projects.


  15. DaemonSet: Ensures that all (or some) nodes run a copy of a pod, typically used for system daemons or log collectors.

3. Install K8S at your local

Require: Docker
Install kubectl
Install Kind
Create Cluster using Kind
Done


Install Helm

 

What is Helm?

1. Install Helm:

If you haven't already installed Helm on your local machine and your Kubernetes cluster, you can follow the instructions provided in the official Helm documentation: Installing Helm.

2. Add Helm Chart Repositories:

Helm uses repositories to store and retrieve charts. You can add popular Helm chart repositories to your Helm configuration using the helm repo add command. For example:

bash
helm repo add stable https://charts.helm.sh/stable helm repo add bitnami https://charts.bitnami.com/bitnami

This adds the stable and Bitnami repositories to your Helm configuration, allowing you to search for and install charts from these repositories.

3. Search for Helm Charts:

You can use the helm search repo command to search for Helm charts available in the configured repositories. For example:

bash
helm search repo wordpress

This command searches for Helm charts related to WordPress in the configured repositories.

4. Customize Helm Values:

Before installing a Helm chart, you may need to customize the values used by the chart. You can create a values.yaml file with your custom configuration values or override specific values using the --set flag when installing the chart.

5. Install Helm Charts:

Once you've found the Helm chart you want to install and have customized the values as needed, you can use the helm install command to install the chart. For example:

bash
helm install my-wordpress stable/wordpress -f values.yaml

This command installs the WordPress Helm chart from the stable repository using the values specified in the values.yaml file.

6. Manage Helm Releases:

You can use various Helm commands to manage your Helm releases, such as helm list to list installed releases, helm upgrade to upgrade releases, and helm delete to delete releases.

7. Helm Charts for Your Applications:

If you have custom applications or services that you want to deploy using Helm, you can create your own Helm charts to package and deploy them. The Helm documentation provides guidance on creating charts: Developing Charts.



Steps to Install ArgoCD on EKS:

  1. Install ArgoCD using Helm:

    Run the following commands to add the ArgoCD Helm repository and install ArgoCD:

    bash
    # Add ArgoCD Helm repository
    helm repo add argo https://argoproj.github.io/argo-helm
    # Create namespace
    kubectl create namespace argocd
    # Install ArgoCD
    helm install argocd argo/argo-cd --name-space argocd
  2. Wait for ArgoCD Pods to be Ready:

    After installing ArgoCD, wait for the pods to be in the Running state. You can use the following command to monitor the pods:

    bash
    kubectl get pods -n argocd
  3. Access ArgoCD UI:

    By default, ArgoCD's UI is not exposed externally. To access the UI, you need to create a port forward:

    bash
    kubectl port-forward svc/argocd-server -n argocd 8080:443

    Now, you can access the ArgoCD UI by navigating to http://localhost:8080 in your web browser. The default username is admin and the password is the pod name of the ArgoCD API server.

  4. Configure ArgoCD:

    Once you're logged into the ArgoCD UI, you can start deploying applications or configuring Git repositories for continuous delivery.

The OCR Service to extract the Text Data

Optical character recognition, or OCR, is a key tool for people who want to build or collect text data. OCR uses machine learning to extract...