Monday, June 14, 2021

JavaScript Masterclass

First of all Thank you Linux World for having a great Masterclass like this and that too for free.

Thank you Vimal Sir and Preeti Ma'am.

I learned a lots of things from this masterclass, even though I am working with JavaScript for long time, but I got to know may new things.

From JavaScript we can give life to webpages, we can make them interactive and user friendly.

Html, js and CSS all these three together make web page good and user friendly

JS can add interactivity, dynamics to page 
CSS can add a good design and give look and feel of page 
Html is the main structure of page i.e it's the skeleton of web page.

With Js we can modify or change any element, it's style, it's attributes on the fly.

With location in js we can make to some other webpage without using anchor tags

We can make js code speak by using Speaking API for free.

With JavaScript as front end and python as backend we can have ML models, being controlled from web page, we can also make a terminal for web based portal and control Linux or docker or any other thing like that.

Using Ajax is important, I remember when I was to use Ajax for first time it took me about 10 hrs to understand it's basics, but sir just took 20 mins to give the whole and sole concept of Ajax and that too with practical included, I love the way sir explains things.

JSON is used for arranging the data in organized way, it helps in transferring data from server to frontend. 

In these 2 days, that too in 8 hrs I learned a lots and lots of things, many of my concepts got more clearer and better.

Thank you Sir for conducting such a great session.

Tuesday, March 2, 2021

Industry use cases for kuberentes and open shift

Yesterday, we had a great session taken by Industry experts and organized by Linux World.

First off I would like to thank Linux world for conducting such a knowledgeable and great session.

In this session, I have gained a lot of information on, why kuberentes are used, how they are helpful to industry needs.

Container technology, which is capable of launching a complete OS in just 5-6 sec that to with very limited ram. 

I learned various use cases of container technology.

Docker is one of the technology that helps us create contains and work on it.

We can use docker in VM. Docker is very light weight and easy to install.

While docker is very useful and easy integrated with other technology, it has some drawbacks like it need admin rights so to overcome all these Podman is used.

Then I learned about openshift, why it's useful.

About S2I.

Then we had demo session.

I learned a lots of things.

Thank you Linux World for conducting this session.


#RedHat #vimaldaga #righteducation #educationredefine #rightmentor #linuxworld #makingindiafutureready #righeducation #arthbylw #containersbylw #kubernetes #openshift #expertsession #amel #daleep 

Sunday, July 12, 2020

AWS-EKS-TASK


AWS - EKS - TASK



EKS - Elastic Kubernetes Service , it is one of the great service offered by AWS , it helps in running K8S on AWS Cloud. It is fully managed by Amazon. It automatically detects the and restart the instances which have gone down / terminated.


Let's get Started :

Creating K8S cluster using AWS EKS :

We will be creating the cluster using a terraform file , because it is the best way as it creates or destroys the cluster in 1 click and also as it is a file we can share it or use it across multiple systems.
First of create a file named clusterdep with file extension as yml , so the file name should look like clusterdep.yml and then write the code given below.

The terraform code used is given below :

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: lwcluster
  region: us-east-1

nodeGroups:
  - name: ng1
    describedCapacity: 1
    instanceType: t2.micro
    ssh:
        publicKeyName: myredhatkey

  - name: ng2
    desiredCapacity: 1
    instanceType: t2.small
    ssh:
        publicKeyName: myredhatkey   

Now lets deploy our terraform code using the following command:

eksctl create cluster -f clusterdep.yml



Here we can see that our cluster is ready and is in active state

 

Now that we have created our cluster lets make some more changes to it and deploy our Wordpress on it , its going to be very interesting !



Lets modify the terraform file made earlier i.e clusterdep.yml

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: lwcluster
  region: us-east-1

nodeGroups:
  - name: ng1
    describedCapacity: 1
    instanceType: t2.micro
    ssh:
        publicKeyName: myredhatkey

  - name: ng2
    desiredCapacity: 1
    instanceType: t2.small
    ssh:
        publicKeyName: myredhatkey
 
  - name: ngmixed
    minSize: 2
    maxSize: 3
    instanceDistribution:
      maxPrice: 0.017
      instanceTypes: ["t3.small","t3.medium"]
      onDemandBaseCapacity: 0
      onDemandPercentageAboveBaseCapacity: 50
      spotInstancePools: 2
    ssh:
        publicKeyName: myredhatkey

Now let's create a web-st-pvc.yml file :

apiVersion: v1
kind: PersistentVolumeClaim

metadata:
  name: lwpvc1

spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi

Now once our cluster is created, we will check for dns and will paste it in browser.
It is worth mentioning that our website works on type LB - load balancer so traffic remains distributed and hence reduce the load on the servers and also we are using pvc so our data is persistent.
we will use kustomization file with secret keys.

kubectl create -k

Now we can launch our wordpress





Here we can see that our wordpress is configured.

Now let's use Helm package to launch Grafana and Prometheus :

HELM: It is a program for installing packages. It is package manager/ chart manager. Helm hub gives us k8s ready applications . The server side used for Helm is tiller.

For initialising Helm we will give the command :

helm init

Then we are required to run the following commands:

helm repo add stable https://kubernetes-charts.storage.googleapis.com/

helm repo list

helm repo update

Now proceeding further we will create tiller, for doing that we will run the following commands:

kubectl -n kube-system create service account tiller

kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

helm init --service-account tiller

kubectl get pods --namespace kube-system

helm init --service-account tiller --upgrade

Now we will install Prometheus with the help of Helm, for doing that we will run the following commands:

kubectl create namespace prometheus

helm install stable/prometheus   --namespace prometheus  --set
alertmanager.presistentVolume.storageClass="gp2"  --set
server.presistentVolume,storageClass="gp2"

kubectl get svc -n prometheus

kubectl -n prometheus port-forward svc/whimsical-buffalo-prometheus-server 8888:80

 
We can see that prometheus is successfully configured

Now lets move further and install grafana, but for doing that we will need to run some specific commands as follows:

kubectl create namespace grafana

helm install stable/grafana  --namespace grafana  --set presistence.storageClassName="gp2" --set adminPassword='GrafanaAdmin' --set datasources."datasources\.yaml".apiVersion=1  --set datasources."datasources\.yaml".datasources[0].name=Prometheus --set datasources."datasources\.yaml".datasources[0].type=Prometheus  --set datasources."datasources\.yaml".datasources[0].url=http://promethus-server.prometheus.svc.cluster.local  --set
datasources."datasources\.yaml".datasources[0].access=proxy    --set
datasources."datasources\.yaml".datasources[0].isDefault=true --set service.type="LoadBalancer"

kubectl get sercret fair-numbat-grafana  --namespace grafana -o ymal

 

we can see that Grafana has been configured successfully.

Now lets configure the Fargate Cluster:

So for creating a fargate we just need to write a simple script.
Let the name of the script be farcluster.yml

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: fargate-lwcluster
  region: ap-southeast-1

fargateProfiles:
  -name: fargate-default
   selectors:
    - namespace: kube-system
    - namespace: default

So as we have created the file now its time to run it , but for doing this as usual we will be running some commands given below :

kubectl get ns

kubectl get pods -n kube-system -o wide

eksctl create cluster -f farcluster.yml

eksctl get cluster --region ap-southeast-1

After running the above commands we will create our cluster , yay!!

You can find all the scripts here: