Get GCP account
Open Cloud Shell
其他配置說明可參考這裡
也可以參考官方文件,輸入 gcloud container clusters create --help
即可閱讀
這樣就可以成功創出一個 GKE cluster
login to gcloud with {YOUR_ACCOUNT}
Once you successfully init gcloud, you can use gcloud container clusters get-credentials....
to login your k8s every time.
k8s 控制台
Set alias for kubectl
Create your namespace
Switch to your namespace
Query the resource under your namespace
Create a random-logger in your namespace
Check the logger in your random-logger
Delete pod
Why pod still exist? Because deployment restart it.
Let's delete the deployment
If you want to interact with Pod,
trykubectl run ubuntu -it --rm --image=ubuntu:16.04
exec 會執行 pod 內的 container 的指定程式
attach 會進入 pod 內 container 的 main process
kubectl expose 會為 deployment 建立一個 service
Check service load balance
Service 後面可以對應多個 deployment,但通常都一對一。
test load balance with busybox
每個 deployment 在該 EKS cluster 的內部都會自動註冊 DNS,所有該 cluster 內的 pod 都可以以此連線到其他 pod。
e.g. cross namespace access <service-name>.<namespace-name>.svc.cluster.local
In busybox:
這部分不用設 service 也會生效
You can check the status of http-balancer in here.
Open browser
NGINS is for aws, google use their own http-balancer
install with local helm chart
kube ops view