GCP Workshop Self Reflection
In these two days we have learned a lot : #Day1
1. We know Google for its Gmail ,YouTube Google search etc . But Google also have its data centre the give us to use their own availability zones buy gcp cloud that is Google cloud platform.
2. We need operating system for running an program and developers are the one who are going to run the program on the top of operating system because the purpose of operating system is to run the services that is webserver, applications ,database etc . But operating systems built on the top of hardware that hardware basically contain compute as a service that is RAM and CPU i.e compute unit ,and storage as a service that is hard disks or storage unit. 3. Suppose we are taking an example of one of the business companies such as Uber Netflix etc.. they can deploy their services Either on the top of their own premises aur on the top of service provider. Here on-premises indicates their own Ram CPU that is their own resources and in on-premises investment is huge and here service provider refers to that one’s who provides compute as a service , provides storage as a service and the service providers is known as cloud computing. Cloud Computing platforms follow the rule of pay as we go.
4. Types of cloud computing : * Public cloud * Private cloud * Multi cloud * Hybrid cloud
5. Here we are going to talk about public cloud and we are familiar with one of the public cloud known as aws but there are more famous public cloud are also present that is GCP, azure, Alibaba etc Note : computing contain all the resources.
6. now we are going to deal with one of the most demanding public cloud known as Google cloud platform or gcp. gcp is the one who provides us resources like compute as a service ,storage as a service ,network as a service etc . Note : for provisioning the OS we have four ways — * Bare metal * Virtualization * Containerization * Cloud computing In cloud world operating system are known as instances or VM.
7. Google compute engine is one service by gcp that provides computer as a service.
8. vpc is one of the service provided by gcp for networking that provide us internal routers switches DHCP etc.
9. Storage where you install operating system is known as block storage and disc is the resource in computer engine that provide us block storage.
10. Data centre : in India gcp has one region known as Asia South 1 that refers to Mumbai contain 3 availability zones such as 1A 1B and 1C that help us for disaster recovery.
11. Suppose we have two instances running one is running in the Singapore region while other is running in the Finland region .if we want these two VM is connected to each other for this public internet is not reliable here the role of Google fibre network come in Play a that is used for connectivity for transfer data from one region to other region.
12. API : it stands for application program interface every service in gcp is running with one program and that is known as API .for every services in gcp Google provide us API initially most of the API is disabled so you have to enable it.
13. There are three ways to connect to API : * Web UI : it is manual way. * CLI : it is automation. * Activate Cloud Shell : it is gcp own command prompt they launch one Linux OS for us where we can run all gcloud command. Note : we have one more way to connect to the API that is SDK (software development kit) such as python code.
14. suppose in our company organisation we are running with three teams one is working as a development team other one is as a testing team and one more is for production team . so then the role of projects in gcp come in play project give us a capability for proper management of resources for different teams we can set quota for this particular accounts for proper management of resource. WEBUI : * Go to project * Click on new project * Give name * Organisation ( for corporate world ) * Project ID ( should be unique ) CLI : * “gcloud” — it show us how many services we can manage and it is a main command that control gcp. Project is a sub command of gcloud. * “cloud projects list” — shows how many project you have. * “gcloud projects create projectid project name” — this command will help us to create a project. Note 1 : for associate your project with billing account — go to building then go to manage then just enable billing for that particular project. Note 2 : “gcloud service list — project name” this command show us which service or API has been running or enabled in that particular project Note 3 : “gcloud service enable API name — project project name” This cmd Enable API for us.
15. For launching an instance of VM we have to use Google compute engine service and follow the following steps : * Os name * Region * Machine type * Bootdisk * Attach one hard disk Note : for CLI at last they give us free created command that we can use at cloud shell.
16. Suppose we have one instance running in Singapore region and at a client side we have to log into this instance so we can use ssh protocol and a for this we require the IP username and password of that instance which is running in Singapore region. then in this instance now our inntentions is to configure the web server that is Apache httpd and and if we are using Linux system that is sent to OS version 7 for this we have to use yum install httpd command. Hear yum is ome command that configure whole http server for us. Then we have to create one page in /var/www/html then we have to start the httpd service and also enable it. By : Systemctl start httpd Systemctl enable httpd now you can use public IP to access to the web server working on port number 80 and for this we have to allow the firewall rule ingress as http at port 80 and ssh Port 22 and icmp for ping and we have to create firewall for http port 80 and connected to the nic card.
17. VPC : it provides network as a service vpc is like a company or we can say that it is like building and inside the vpc we have multiple subnets that is Labs. Vpc internally provide routers switches and DHCP server etc for us. If in one VPC we are running with two subnets that is lab1 and lab2 and we want to connect these two subnets or labs we have to do network peering. Suppose we have one OS running in Singapore region having one private IP and one public IP and we have one more OS running in US region also having one private IP and one public IP. but if client would like to connect to these instances they can easily connect via public network to the public IP over internet. but if we want to transfer the data from one instance to the other instance in the private world we have to use private IP and in the private world we can transfer data in the same network. if we connect two VPC the concept is known as VPC peering. vpc give us an option for vpc network peering from both sides that is from both VPC.
#Day2 >> GOOGLE KUBERNETES ENGINE
- GCP provide us many service and one of the many service is Google kubernetes engine. Now we have to know how kubernetes work : hashtag#KUBERNETES • one use case is — if your OS running with the webserver goes down i.e completely terminated so there will be a huge lose in business and any of the client try to access your website , it fails . For this kind of scenario we need a program that keep on monitoring that particular OS and if OS terminated this program sends notification to the team and then the team contact to docker and again launch the same OS but this part is manual. I want instead my program i.e code sends notification to human beings to Launch one more OS, these program automatically launch OS within a milisecond. • If you want fault Tolerance type of infrastructure you need that monitoring program then kubernetes role come in play. Kubernetes is a tool or program that has an inbuilt capability to keep on monitoring the container. docker has its own product for monitoring i.e swarm but kubernetes is more powerful than swarm.
- another use case is — if your OS running with the webserver so your webserver has a limit that is in 1 second it can accommodate 100 clients only but suddenly your getting 1000 of clients in 1 second and they are not able to connect , your site is showing error server time out so rather we launch one more OS again we can run program , as soon as no of request comes up i.e clients suddenly increases our program automatically launch one more OS for us and if client decreases code terminate that OS. Here we are doing scaling if client increase our program add new OS that is scale in while if client decreases our program terminate that OS that is scale out. And if your requirements is to increase RAM,CPU,HD, Network card etc that is scale up while if your requirements is to decrease RAM,CPU,HD, Network card etc that is scale down. • Scale in and Scale out are the part of horizontal scaling while scale up and scale down are the part of vertical scaling. Program who manages scaling is known as kubernetes
- One more use case is : if we are running with three OS having webserver ,the biggest challenge here is we don’t know the IP , what new IP comes when new OS launched by a program and we don’t want to give 100 of IPs to the client.. • so again we write a code and provide one IP i.e node IP to the client and tell them suppose IP 100 is a webserver. If somebody come to IP 100 behind the scene IP 100 goes to IP 1 and deploy the webserver for client and for balancing the load .. when the next client comes to IP 100 send them to IP 2 and deploy the webserver and so on and the program which is doing Load balancing for us is known as Kubernetes.
- kubernetes : * It manages fault Tolerance part . * It manages auto scaling part . * It manages load balancing part . And tone’s of use case’s managed by kubernetes. • clustering : * If you have one or more master and multiple slaves and they work together this kind of set up is known as multinode cluster. * If you have one node and both master and slave are using this node this kind of set up is known as singlenode cluster • minikube: * It is just a program to install kubernetes. * It setup the clusters. * It make things very easy • minikube Commands * minikube start — when you run this command first time .. it download the iso file and create the VM and install it for you and second time it starts minikube services. Note — in kubernetes when we launch container it is known as pod.
• kubernetes commands * Kubectl : it is client command and it connects you to the kube cluster. * Kubectl get pods : it shows how many pods are running. * Kubectl launch deployment : it launch container using image. * Kubectl delete pods : it terminates pods. * Kubectl describe pods : it gives information about pods. * Kubectl expose deployment : it connect to the outside world. * Kubectl get all : it shows services information, desired , current , ready etc. * Kubectl scale deployment : it provide replicas i.e copy of OS. * Kubectl delete pods -all : it deletes all pods.
- POD : * It is not at all equal to container. * Pod contain containers. * It is the main unit of kube. * Kube always monitor your pod. * Inside the pod we have containers. * Pod is the only one who manages your containers&contact DE to launch container • Kubectl run : it only launch pod.. this time lube don’t support for fault Tolerance only this power comes from deployment. • Kubectl : it is a client program . They only bother about where is your master because they always connect to the master node . Kubectl first always go to the config file. • kube API server program : it listen to the client and ask kubectl what they want and 8443 is the fixed port for API. • For config file you need CA, CRT and key for authentication. Note : some of the information I also provide related to minikube.
- But how our frontend server came to know the IPs of differents pods , here we use the register concept . Either we manually register the backend servers IPs to the frontend server or we automatically register them and we know today is the world of automation so we always go for automated way. Load balancer is very intelligent whenever we launch one new pod that pod IP will be automatically register to the frontend server and that concept is known as automated discovery. Note : * Frontend server ip:port is known as end point. * We use round robin mechanism for the load balancer.
• For aws — we use ELB i.e elastic load balancer for creating load balancer. ELB is a subservice of EC-2. For k8s — we use services for creating load balancer. • There are three types for services available depend upon use case : * ClusterIP — it always works inside the cluster i.e it work in a isolate way. If we have use case we don’t want to provide outside connectivity to the clients . In this kind of use case we have to create service i.e load balancer known as clusterIP * NodePort — when your POD will have outside connectivity then we have to expose it and we have to create one service type know as NodePort. * LoadBalancer — it is a one type of service which balances the node between two ports. Mostly used in multinode clusters
• Google kubernetes engine provides one command to connect to master and slave using Windows or wherever you are g-cloud program running then you can run all the kubernetes command using kubectl such as Kubectl get nodes Kubectl get pods Kubectl get ns • replica are the one that do horizontal scale in for scale out for us. • gcp cloud has one load balancing service named as load balancer that is an independent service of load balancer. • but we can also configure load balancer using kubernetes that take gcp external load balancer. • In kubernetes world’s No load balancer is known as service. • creating a GKE cluster : we have to set cluster basic where we set the location type as zonal or regional . In the node pools we have to set image type, machine type, boot disc , one node per zone in slave nodes • GCP has also provided as one SQL service that we can use as a backend to connect our wordpress pod as a front end. for creating and SQL we have to provide instance ID ,root password ,location and version and we also have to set firewall rule. hashtag#IAM • initially gcp create root account for us that has all the power to do anything in any of the project this power is known as role this role is typically known owner role.
- IAM is a way through which we can give access to multiple user that some user have owner power other one has view power while some other has edit power only.
- #GoogleAppEngine • it provide us platform as a service which is useful for developer to test the codes.