【问题标题】:What are the GKE (with IP alias enabled) pod/service IP ranges?什么是 GKE(启用 IP 别名)pod/service IP 范围?
【发布时间】:2018-11-28 09:10:50
【问题描述】:

我正在尝试使用 terraform 创建 GKE 集群,但我被卡住了,因为对于 pod / services 子网,我不知道 GKE 默认使用哪些值作为主要 IP 范围和辅助 IP 范围。

在以下 terraform 配置中,默认的 GKE 值是什么:

google_compute_subnetwork.pods.ip_range
google_compute_subnetwork.pods.secondary_ip_range.ip_range
google_compute_subnetwork.services.ip_range
google_compute_subnetwork.services.secondary_ip_range.ip_range

?


resource "google_compute_network" "primary" {
    name                    = "${var.cluster_name}"
    auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "pods" {
    name          = "pods-primary"
    region        = "${var.region}"
    ip_cidr_range = ""
    network       = "${google_compute_network.primary.self_link}"

    secondary_ip_range {
        range_name    = "pods-secondary"
        ip_cidr_range = ""
    }
}

resource "google_compute_subnetwork" "services" {
    name          = "services-primary"
    region        = "${var.region}"
    ip_cidr_range = ""
    network       = "${google_compute_network.primary.self_link}"

    secondary_ip_range {
        range_name    = "services-secondary"
        ip_cidr_range = ""
    }
}

【问题讨论】:

    标签: google-cloud-platform google-kubernetes-engine


    【解决方案1】:

    没关系,使用 vpc 本机,没有定义默认 cidr 范围

    【讨论】:

    • 是,建议的范围是 10.0.0.0/8、172.16.0.0/12 或 192.168.0.0/16。您如何打破这些 CIDR 范围,以便它们可以在 pod 和服务范围中使用?例如 192.168.0.0/16,我想将此 CIDR 用于 pod 和服务。该怎么做?
    【解决方案2】:

    主要 IP 范围和次要 IP 范围的 GKE 默认值基于

    如果您需要自定义这些值,请关注这些guidelines

    关于将使用哪些 CIDR,如果用户未提供,GKE 将从 10.0.0.0/8 分配一个随机 /14 块(如果集群在默认网络中,则从 10.128.0.0/9 除外)。

    这个范围是集群的 Pod 范围。当一个节点添加到 GKE 集群时,会从 Pod 范围内分配一个 /24 块并分配给该节点。

    对于基于路由的集群,集群 IP 范围的最后 /20 块留给使用 ClusterIP 的服务的 IP 地址,不适用于节点分配块。

    对于别名 IP 集群,Pod 范围之外的单独 /20 块保留给使用辅助范围的服务。

    【讨论】:

    • 我的问题是 pod/service 的主要和次要的 cidr 值是多少。我知道它们基于这些值,但该表不包括 cidrs
    • @snkcld 将此信息添加到我的答案中。
    猜你喜欢
    • 2016-05-16
    • 2019-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-07
    • 2019-09-02
    • 2018-01-04
    • 2014-01-16
    相关资源
    最近更新 更多