*GCP에서는 머신이미지, 이미지, 스냅샷을 통해 백업을 할 수 있음.
-Snapshot(기억장치) : incremental(증분) 가능
$ kubectl get pods
$ kubectl expose de
Our next section deals at managing Kubernetes Engine resources. In particular, we'll look a bit more closely at how to deploy and work with Kubernetes pods. A deployment represents a group of replicas of the same pod and keeps your pods running, even when nodes they run on fail. You could represent a component of an application or an entire App. In this case, the engine acts web server by default pods and deployment are only accessible inside your GKE cluster. To make them publicly available, you can connect a load balancer to your deployment by running the Cube CTL exposed command. Kubernetes then creates a service with a fixed type key for your pods, and the controller says, I need to attach an external load balancer with a public IP address chat service, so others outside the cluster can access it. In GKE, the load balancer is created as a network load balancer. Instead of issuing commands, you can provide a configuration file that tells Kubernetes what do you want your desired state to look like, and Kubernetes figures out how to do it. To get the file, you can run a Cube CTL get pods command as shown here to get a YAML file. In this case, the YAML file declares that you want three replicas of your engine next pod. It also defines a selector field, so the deployment knows how to group specific pods' replicas, and you could add a label to the pod templates, so they get selected. To run five replicas instead of three, all you do is update the deployment conflict file, and then run the Cube CTL apply command to use the updated config file.
A. CLUSTER
B. Pod
GKE가 제공하는 것
1) Compute Engine instances에 대한 Load Balacing
2) Node Pools로 cluster안에 하위 subsets of nodes 제공 for additional flexibility.
3) Automatic scaling of your cluster's node instance 개수.
4) Automatic upgrades for your cluster's node software.
수동 업그레이드하면 자동 업그레이드보다 더 최신을 가질 수도 있다. 일반적으로 베타 or 공개버전인 것을 GKE 포함. 알파 버전은 GKE알파클러스터에서 사용한다.
5) Node auto-repair to maintain node health and availability.
6) Cloud Logging and Monitoring for visibility into your cluster.
# GCLOUD 계정 정보
gcloud auth list
# GCLOUD 프로젝트 정보
gcloud config list project
# 지역정보 셋팅
gcloud config set compute/zone us-central1-a
# Cluster 생성
gcloud container clusters create my-cluster
# 생성한 Cluster 권한 얻기
gcloud container clusters get-credentials my-cluster
# hello container 생성
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0
# port 열기
kubectl expose deployment hello-server --type="LoadBalancer" --port 8080
>> Load Balacer를 설정하고 외부 IP 설정해줌
# YAML에 어떤 pod를 배포하고 싶은지 설정해서 실행. ( template - 갯수를 다르게 함으로써 쉽게 크기 조절 가능)
kubectl get pods -l "app=nginx"
kubectl apply -f nginx-deployment.yaml
# kubernetes로 실행
kubectl get service hello-server
# delete cluster
gcloud container clusters delete [CLUSTER-NAME]
App Engine은 확장 가능한 웹 애플리케이션을 개발하고 호스팅하기 위한 완전 관리형 서버리스 플랫폼
Scaling :
1) manual : use resident instances, 계속 런 하는 특정 갯수의 instances. low-level과 무관하다. 복잡한 초기설정, 메모리에 의존적
2) basic : dynamic instances. 가장 기본적. idle상태일 때 멈춤.
3) automatic : dynamic instances, 최소 instaces를 정해둘 수 있다.
1) Object lifecycle management
Our next section deals with choosing the best options for managing your solution's data. In particular, we'll look at storage type options for managing cloud storage buckets.
You can assign a life cycle management configuration to a bucket. The configuration contains a set of rules which apply to current and future objects in the bucket.
When an object meets the criteria of one of the rules, cloud storage automatically performs its specified action on the object. Here are some example use cases. Downgrade the storage class of objects older than 365 days to cold line storage. Delete objects created before January 1, 2013. Keep only the three most recent versions of each object in a bucket with versioning enabled.
The following actions are supported for lifecycle, delete, delete live and/or archived objects. This action can be applied to both versioned and non-versioned objects. In a bucket with versioning enabled, deleting a live object archives the object, or deleting an archived object believes object permanently.
SetStorageClass, change the storage class of live and/or archived objects. This action can be applied to both versioned and non-versioned objects. The following conditions are supported for a lifecycle rule. Age, this condition is satisfied when an object reaches a specified age in days. CreatedBefore, this condition is satisfied when an object is created before midnight, the specified date and UTC is live. If the value is true, this life cycle conditions matches only live objects. If the value is false it matches only archive objects. MatchesStorageClass, this condition is satisfied when an object in the bucket is stored as a specified storage class. NumberOfNewerVersions, relevant only for versioned objects. If the value of this condition is set to n, an object satisfies the condition when there are at least n versions, including the live versions newer than n. For live objects, the number of newer versions is considered to be zero.
‼️how to expand the CIDR block subnet
그전에
Subnet IP란 : Primary range, Secondary range가 있는데 두개는 contiguous하지 않아도 된다.
Instances를 쓰지 않을 때만 삭제 또는 대체될 수 있따.
늘릴수는 있지만 줄일수는 없다. 최대 8 ~29까지
Create policy 가능
VM Images: https://cloud.google.com/compute/docs/images
Creating, deleting, deprecating custom images: https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images
Creating snapshots: https://cloud.google.com/compute/docs/disks/create-snapshots
How App Engine instances are managed: https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed
Object lifecycle management: https://cloud.google.com/storage/docs/lifecycle
Expanding subnets: https://cloud.google.com/vpc/docs/using-vpc#expand-subnet
Introduction to Alerting: https://cloud.google.com/monitoring/alerts/
Managing alerting policies: https://cloud.google.com/monitoring/alerts/using-alerting-ui