通过gcloud创建Google Kubernetes Engine(GKE)并通过kubectl访问

1 简介

GKE(Google Kubernetes Engine)是一个K8s平台, 我们可以使用gcloud来创建GKE集群。在开始之前,可以查看:《初始化一个GCP项目并用gcloud访问操作》。

2 创建GKE集群

2.1 打开API

在创建集群之前,需要打开Google API,不然无法操作:

$ gcloud services enable compute.googleapis.com
$ gcloud services enable container.googleapis.com

2.2 创建

K8s集群的节点机器类型多种多样,可以查看一下某个区都有哪些机器类型:

$ gcloud compute machine-types list | grep us-west

这里我选择一个便宜的:n1-standard-1

使用 gcloud container clusters create 来创建:

$ gcloud container clusters create pkslow-k8s \
--zone us-west1-a \
--cluster-version 1.20.10-gke.1600 \
--machine-type n1-standard-1

WARNING: Currently VPC-native is not the default mode during cluster creation. In the future, this will become the default mode and can be disabled using `--no-enable-ip-alias` flag. Use `--[no-]enable-ip-alias` flag to suppress this warning.
WARNING: Starting with version 1.18, clusters will have shielded GKE nodes by default.
WARNING: Your Pod address range (`--cluster-ipv4-cidr`) can accommodate at most 1008 node(s). 
WARNING: Starting with version 1.19, newly created clusters and node-pools will have COS_CONTAINERD as the default node image when no image type is specified.
Creating cluster pkslow-k8s in us-west1-a...done.                                                  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值