# GCP 進階技術課2 ## Cloud storage ### 特性 * 高可用性: 可以存多 region 提高可用性 * 跨區域備援: * multi-region, * dual-region(跨國同步) * turbo replication RPO * regional * 多種存儲類型: 4 種類型的硬碟沒有讀取速度差異,在於拿取資料速度,有存儲時長的規定,需付檢索費用,轉成別種 type 是要收費。 * standard: 存取週期性經常存取,貴!比 archive 差20倍,無最短儲存時長,無檢索費用,適合 ap 服務需要時常索取的。 * nearline:存取週期一個月小於一次(常態備份與最後儲存空間) * coldline: 存取週期一季小於一季(常態備份與最後儲存空間) * archive: 存取週期一年小於一次(常態備份與最後儲存空間),最短儲存時長:365d,檢索費用最貴!適合audit log(稽核需要用的) * autoclass: 會自動配置適合的儲存 type,且轉換是不需要收費的。 ex. object 太久沒有使用會被收到 nearline,但之後很常使用又會被放回 standard。     * 可自訂儲存時間  #### 雲地端 storage 差異? 1. 無上限空間 ### backup to gcp #### 架構 1. on-premeiss -> vpc -> gcs 2. on-premeiss -> partner interconnect(最建議) -> gcs -> multi region gcs 3. on-premeiss NBU(加密,一鍵上傳雲端) -> interconnect -> gcs -> restore to server -> vm #### 內網 backup * 一定會有 ssl 加密 * google 都是用 api 呼叫服務 * \*googleapis.com cname 轉送 private.googleapis.com,再進到 google 內網 #### gcp 備份上雲工具: - gsutil * bandwidth: ~300Mbps ~ 3Gbps * data size: <10G * transfer type: One time/Sync - tsop * bandwidth: 300Mbps~50Gbps * charged * data size: 10g - 50pb * 地端建一個 agent,agent 幫上傳,好用 * 有 UI? - tramsfer appliance * bandwidth: < 300 Mbps * data size: 50pb + * transfer type: one time * 台灣目前沒有! #### lifecycle - 選項:storage type 一定時間後轉成變的 type or delete #### version control - gcs 是 object based storage:開啟 version control 後上傳的檔案是無法被做修改的!沒開的話會被覆寫掉! - 依據覆寫的情況,可以設定保存幾個版本,如果超過保存上限,就會刪除最舊的版本 - 也可以設定日期,超過幾天就刪除檔案 #### retention policy * 定義完後不可以去改他不能刪除 --> 是指甚麼不能刪除~? * object 最少須保存多久,這中間不可以刪除 * 可以設定 policy lock: 時間沒到任何人都不能刪除 policy * policy 可以被刪除 ### 實作 利用 gcs 來做一個靜態網站 1. 建立 gcs bucket 2. https://esun.dynacloud.site/test.txt 另存為 test.html 3. 將 test.html 上傳到 bucket 4. 將 bucket 設定為對外開放: 不要勾選 Enforce public access prevention on this bucket (但還是要IAM再設定)  5. 給 all user 角色: storage object viewer  ## cloud load balancing ### 特色 - anycast IP: google 全球各地都有 load balancer,只要有一組 load balancer ip 就可以 access 到全球各地 backend,依據位置優先導到最近的 backend - 軟體定義的LB, 高可用性高可擴充性 - 支援每秒百萬次以上請求 - 整合 Cloud CDN - 整合 Cloud Armor(WAF) - google managed certification: 免錢 ### 架構 - layer 7 - layer 4 anycast ip -> clobal forwarding rule -> 最近的 target proxy -> url map -> backend service  #### hybrid workloads - 外部流量透過 gcp load balancer,可以進到 gcp服務,並走內網可以道地端或是其他雲,做到雲地混  ### 實作 建立 http load balancer 1. 建立 vpc 2. 建立允許 http https 流量的 firewall rule 3. 建立作為 lb 的 instance template(MIG) 4. 使用該template 建立VPC 1. 輸入VPC名稱: esun-lesson3 2. 子網路名稱:asia-east1 3. 區域 asia-east1 4. ipv4:10.128.10.0/24 5. 建立   建立firewall 1. allow http, https  **建立 MIG** 建立 template 1. compute engine >> instance templates    2. 選擇建立執行個體範本 Create Instance Group  compute engine 那邊就跑出 2 台了!  **建立 LB** Create a load balancer > Application Load Balancer (HTTP/S) [frontend]  [health check]  [backend service]  [cancel cdn, choose hc]  透過 frontend ip 可以去測測看有沒有 lb 效果  ## CDN 不用特別選 CDN 要在哪個區域,goole 會自己幫你找最近的地方跳 1. 加速讀取(cache 功能) 2. 降低 server loading 3. 穩定性 4. 安全性 5. 使用 QUIC, BB2 ### 功能 - 自定義緩存鍵 ### 實作 1. create backend bucket  2. set routing rule  此時透過以下網址就可以跳到靜態網頁(34.149.218.125 為 lb ip): http://34.149.218.125/test.html ## cloud armor * 提供完善的應用程式與網站保護,阻斷攻擊,限制某些IP & request(設定 rate limit) * 須與 lb 一起使用 ### 基本功能 * 防護 DDoS ### 進階功能 (貴!) * adaptive protection: 根據 ML 來幫你看出怎樣是異常流量!然後幫你阻擋! * bill protection: 如果發現是 DDoS 會把你多花的 request 錢還給你。 ### 實作 cloud armor demo (課堂略過><) ## GKE 1. IAM 權限綁定 k8s 權限 2. certified images: 經過 google sre 測試ㄔ 3. 資料加密: 靜態資料加密、傳輸加密 4. private cluster: 無須外網 access cluster ### trusted networking 1. global vpc 2. global lb ### reliable 1. auto provision 2. auto scale 3. auto upgrade 4. auto fix, rollback ### availability 1. global regions 2. SRE monitoring 3. regional clusters: 台灣有3個zone ### reduced cost 1. preemptible node pools 2. no ops overhead 3. customer friendly pricing ### application accelerators 1. local SSD 2. Cloud TPU: ML 3. Cloud GPU: Advanced data processing ### developer productivity 1. CI/CD 2. Deployment speed 3. auto provisioning - managed control plane - 自動修復 node - GKE Autopilot - 實際只要 worker node management - Node Pool specification & configuration - 缺點: 擴展速度有時慢 ### google managed prometheus 1. google 免費存到效能高的時序資料庫(monarch?) 2. grafana 可以透過 sa credentail 在 source data 把 google cloud monitoring data 匯進來 ## anthos - multi-cluster management platform - 控管混合雲 k8s,ex. config, version ### anthos config management(ACM) - giitops automation suit ### anthos service mesh(ASM) - zero trust networking ### anthos on vmware high level architecture admin workstation 來下指令操作 k8s admin cluster 專門管理其他 k8s 的 k8s XD 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up