버전 1.1. 이 버전은 Anthos 버전 지원 정책에 설명된 대로 더 이상 지원되지 않습니다. VMware용 Anthos 클러스터(GKE On-Prem)에 영향을 미치는 보안 취약점, 노출, 문제에 대한 최신 패치와 업데이트를 확인하려면 지원되는 버전으로 업그레이드하세요. 최신 버전은 여기에서 확인할 수 있습니다.
여기서 1.1.2-gke.0은 최신 버전의 GKE On-Prem입니다. OVA에는 GKE On-Prem 클러스터를 설치하고 관리하는 데 필요한 모든 클러스터 구성요소, 명령줄 도구 및 기타 항목이 포함됩니다.
최신 버전의 OVA에는 이러한 항목의 최신 버전이 포함됩니다.
이 파일을 관리자 워크스테이션을 만드는 데 사용중인 컴퓨터의 다른 위치에 저장합니다.
govc를 사용하여 OVA를 vSphere로 가져오고 VM 템플릿으로 표시
다음 섹션에서는 다음을 수행합니다.
vCenter Server와 vSphere 환경의 요소를 선언하는 일부 변수를 만듭니다.
관리자 워크스테이션 OVA를 vSphere로 가져와 VM 템플릿으로 표시합니다.
govc용 변수 만들기
관리자 워크스테이션 OVA를 vSphere로 가져오기 전에 vCenter Server와 vSphere 환경의 요소를 선언하는 일부 govc 변수를 제공해야 합니다.
# If you want to use a resource pool you've configured yourself, export this variable:
export GOVC_RESOURCE_POOL=[VSPHERE_CLUSTER]/Resources/[VSPHERE_RESOURCE_POOL]
# If you want to use vSphere's default resource pool, export this variable instead:
export GOVC_RESOURCE_POOL=[VSPHERE_CLUSTER]/Resources
각 항목의 의미는 다음과 같습니다.
[VCENTER_SERVER_ADDRESS]는 vCenter Server의 IP 주소 또는 호스트 이름입니다.
[VCENTER_SERVER_USERNAME]은 vCenter Server의 관리자 역할 또는 동등한 권한을 보유한 계정의 사용자 이름입니다.
[VCENTER_SERVER_PASSWORD]는 vCenter Server 계정의 비밀번호입니다.
[VSPHERE_DATASTORE]는 vSphere 환경에서 구성한 Datastore의 이름입니다.
[VSPHERE_DATACENTER]는 vSphere 환경에서 구성한 데이터센터의 이름입니다.
[VSPHERE_CLUSTER]는 vSphere 환경에서 구성한 클러스터의 이름입니다.
기본이 아닌 리소스 풀을 사용하는 경우 각 항목의 의미는 다음과 같습니다.
[VSPHERE_RESOURCE_POOL]은 vSphere 환경에 구성한 리소스 풀의 이름입니다.
OVA를 vSphere로 가져오기: 표준 스위치
vSphere 표준 스위치를 사용하는 경우 다음 명령어를 사용하여 OVA를 vSphere로 가져옵니다.
여기서 [TERRAFORM_DIR]은 Terraform 파일을 보관할 디렉터리의 경로입니다.
관리 워크스테이션에 고정 IP 주소를 지정할지 아니면 DHCP 서버를 사용하여 IP 주소를 가져올 지에 따라 다음 Terraform 구성 중 하나를 복사합니다.
TF 및 TFVARS 파일을 모두 복사해야 합니다. TF 파일은 VM을 만드는 Terraform HCL 구성입니다.
구성을 각각 [TERRAFORM_DIR]/terraform.tf 및 [TERRAFORM_DIR]/terraform.tfvars에 저장합니다.
DHCP
공개 화살표를 클릭하여 DHCP의 Terraform 파일을 표시
terraform.tfvars
# vCenter Server username
vcenter_user = "administrator@vsphere.local"
# vCenter Server password
vcenter_password = ""
# vCenter Server IP or hostname
vcenter_server = ""
# Path in which the admin workstation's VM's public key should be saved
ssh_public_key_path = "~/.ssh/vsphere_workstation.pub"
# Hostname for the VM
vm_name = "admin-workstation"
# vSphere datastore to use for storage
datastore = ""
# vSphere datacenter in which to create the VM
datacenter = ""
# vSphere cluster in which to create the VM
cluster = ""
# vSphere resource pool in which to create VM, if you are using a non-default resource pool
# If you are using the default resource pool, provide a value like "CLUSTER-NAME/Resources"
resource_pool = ""
# vSphere network to use for the VM
network = "VM Network"
# Number of CPUs for this VM. Recommended minimum 4.
num_cpus = 4
# Memory in MB for this VM. Recommended minimum 8192.
memory = 8192
# The VM template (OVA) to clone. Change the version if you imported a different version of the OVA.
vm_template = "gke-on-prem-admin-appliance-vsphere-1.1.2-gke.0"
terraform.tf
#########################
####### VARIABLES #######
#########################
# The following variables are declared in the accompanying TFVARS file
# vCenter Server username
variable "vcenter_user" { }
# vCenter Server password
variable "vcenter_password" { }
# vCenter Server address
variable "vcenter_server" { }
# Path in which the VM's public key should be saved
variable "ssh_public_key_path" { default = "~/.ssh/vsphere_workstation.pub" }
# vSphere network to use for the VM
variable "network" { default = "VM Network"}
# Hostname for the VM
variable "vm_name" { default = "vsphere-workstation" }
# vSphere datacenter in which to create the admin workstation VM
variable "datacenter" { }
# vSphere datastore to use for storage
variable "datastore" { }
# vSphere cluster in which to create the VM
variable "cluster" { }
# vSphere resource pool in which to create the VM
variable "resource_pool" { }
# Number of CPUs for this VM. Recommended minimum 4.
variable "num_cpus" { default = 4 }
# Memory in MB for this VM. Recommended minimum 8192.
variable "memory" { default = 8192 }
# The VM template (OVA) to clone
variable "vm_template" { }
##########################
##########################
provider "vsphere" {
version = "~> 1.5"
user = "${var.vcenter_user}"
password = "${var.vcenter_password}"
vcenter_server = "${var.vcenter_server}"
# if you have a self-signed cert
allow_unverified_ssl = true
}
### vSphere Data ###
data "vsphere_datastore" "datastore" {
name = "${var.datastore}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_datacenter" "dc" {
name = "${var.datacenter}"
}
data "vsphere_compute_cluster" "cluster" {
name = "${var.cluster}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_resource_pool" "pool" {
name = "${var.resource_pool}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_network" "network" {
name = "${var.network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_virtual_machine" "template_from_ovf" {
name = "${var.vm_template}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "template_file" "dhcp_ip_config" {
template = <<EOF
network:
version: 2
ethernets:
ens192:
dhcp4: true
EOF
}
data "template_file" "user_data" {
template = <<EOF
#cloud-config
apt:
primary:
- arches: [default]
uri: http://us-west1.gce.archive.ubuntu.com/ubuntu/
write_files:
- path: /etc/netplan/99-dhcp.yaml
permissions: '0644'
encoding: base64
content: |
$${dhcp_ip_config}
runcmd:
- netplan apply
- /var/lib/gke/guest-startup.sh
EOF
vars = {
dhcp_ip_config = "${base64encode(data.template_file.dhcp_ip_config.rendered)}"
}
}
### vSphere Resources ###
resource "vsphere_virtual_machine" "vm" {
name = "${var.vm_name}"
resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
num_cpus = "${var.num_cpus}"
memory = "${var.memory}"
guest_id = "${data.vsphere_virtual_machine.template_from_ovf.guest_id}"
enable_disk_uuid = "true"
scsi_type = "${data.vsphere_virtual_machine.template_from_ovf.scsi_type}"
network_interface {
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template_from_ovf.network_interface_types[0]}"
}
wait_for_guest_net_timeout = 15
nested_hv_enabled = false
cpu_performance_counters_enabled = false
disk {
label = "disk0"
size = "${max(50, data.vsphere_virtual_machine.template_from_ovf.disks.0.size)}"
eagerly_scrub = "${data.vsphere_virtual_machine.template_from_ovf.disks.0.eagerly_scrub}"
thin_provisioned = "${data.vsphere_virtual_machine.template_from_ovf.disks.0.thin_provisioned}"
}
cdrom {
client_device = true
}
vapp {
properties = {
hostname = "${var.vm_name}"
public-keys = "${file(var.ssh_public_key_path)}"
user-data = "${base64encode(data.template_file.user_data.rendered)}"
}
}
clone {
template_uuid = "${data.vsphere_virtual_machine.template_from_ovf.id}"
}
}
output "ip_address" {
value = "${vsphere_virtual_machine.vm.default_ip_address}"
}
고정 IP
공개 화살표를 클릭하여 고정 IP의 Terraform 파일을 표시
terraform.tfvars
# vCenter Server username
vcenter_user = "administrator@vsphere.local"
# vCenter Server password
vcenter_password = ""
# vCenter Server IP or hostname
vcenter_server = ""
# Path in which the admin workstation's VM's public key should be saved
ssh_public_key_path = "~/.ssh/vsphere_workstation.pub"
# Hostname for the VM
vm_name = "admin-workstation"
# vSphere datastore to use for storage
datastore = ""
# vSphere datacenter in which to create the VM
datacenter = ""
# vSphere cluster in which to create the VM
cluster = ""
# vSphere resource pool in which to create VM, if you are using a non-default resource pool
# If you are using the default resource pool, provide a value like "CLUSTER-NAME/Resources"
resource_pool = ""
# vSphere network to use for the VM
network = "VM Network"
# Number of CPUs for this VM. Recommended minimum 4.
num_cpus = 4
# Memory in MB for this VM. Recommended minimum 8192.
memory = 8192
# The VM template (OVA) to clone. Change the version if you imported a different version of the OVA.
vm_template = "gke-on-prem-admin-appliance-vsphere-1.1.2-gke.0"
################################################
# Static IP settings #
################################################
# An IPv4 static IP for the admin workstataion; for example, 100.115.250.100
ipv4_address = "100.115.250.100"
# The netmask prefix length to use; for example, 22
ipv4_netmask_prefix_length = "22"
# The IPv4 gateway the admin workstation should use; for example, 100.115.251.254
ipv4_gateway = "100.115.251.254"
# Comma-delimited DNS servers
dns_nameservers = "8.8.8.8,8.8.4.4"
terraform.tf
#########################
####### VARIABLES #######
#########################
# The following variables are declared in the accompanying TFVARS file
# vCenter Server username
variable "vcenter_user" { }
# vCenter Server password
variable "vcenter_password" { }
# vCenter Server address
variable "vcenter_server" { }
# Path in which the VM's public key should be saved
variable "ssh_public_key_path" { default = "~/.ssh/vsphere_workstation.pub" }
# vSphere network to use for the VM
variable "network" { default = "VM Network"}
# Hostname for the VM
variable "vm_name" { default = "vsphere-workstation" }
# vSphere datacenter in which to create the admin workstation VM
variable "datacenter" { }
# vSphere datastore to use for storage
variable "datastore" { }
# vSphere cluster in which to create the VM
variable "cluster" { }
# vSphere resource pool in which to create the VM
variable "resource_pool" { }
# Number of CPUs for this VM. Recommended minimum 4.
variable "num_cpus" { default = 4 }
# Memory in MB for this VM. Recommended minimum 8192.
variable "memory" { default = 8192 }
# The VM template (OVA) to clone
variable "vm_template" { }
# The IP address to assign to the VM
variable "ipv4_address" { }
# Netmask prefix length
variable "ipv4_netmask_prefix_length" { }
# Default gateway to use
variable "ipv4_gateway" { }
# DNS resolvers to use
variable "dns_nameservers" { }
##########################
##########################
provider "vsphere" {
version = "~> 1.5"
user = "${var.vcenter_user}"
password = "${var.vcenter_password}"
vcenter_server = "${var.vcenter_server}"
# if you have a self-signed cert
allow_unverified_ssl = true
}
### vSphere Data ###
data "vsphere_datastore" "datastore" {
name = "${var.datastore}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_datacenter" "dc" {
name = "${var.datacenter}"
}
data "vsphere_compute_cluster" "cluster" {
name = "${var.cluster}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_resource_pool" "pool" {
name = "${var.resource_pool}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_network" "network" {
name = "${var.network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
data "vsphere_virtual_machine" "template_from_ovf" {
name = "${var.vm_template}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
##########################
### IF USING STATIC IP ###
##########################
data "template_file" "static_ip_config" {
template = <<EOF
network:
version: 2
ethernets:
ens192:
dhcp4: no
dhcp6: no
addresses: ["${var.ipv4_address}/${var.ipv4_netmask_prefix_length}"]
gateway4: ${var.ipv4_gateway}
nameservers:
addresses: [${var.dns_nameservers}]
EOF
}
data "template_file" "user_data" {
template = <<EOF
#cloud-config
apt:
primary:
- arches: [default]
uri: http://us-west1.gce.archive.ubuntu.com/ubuntu/
write_files:
- path: /tmp/static-ip.yaml
permissions: '0644'
encoding: base64
content: |
$${static_ip_config}
runcmd:
- /var/lib/gke/guest-startup.sh
EOF
vars = {
static_ip_config = "${base64encode(data.template_file.static_ip_config.rendered)}"
}
}
##########################
### IF USING STATIC IP ###
##########################
### vSphere Resources ###
resource "vsphere_virtual_machine" "vm" {
name = "${var.vm_name}"
resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
num_cpus = "${var.num_cpus}"
memory = "${var.memory}"
guest_id = "${data.vsphere_virtual_machine.template_from_ovf.guest_id}"
enable_disk_uuid = "true"
scsi_type = "${data.vsphere_virtual_machine.template_from_ovf.scsi_type}"
network_interface {
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template_from_ovf.network_interface_types[0]}"
}
wait_for_guest_net_timeout = 15
nested_hv_enabled = false
cpu_performance_counters_enabled = false
disk {
label = "disk0"
size = "${max(50, data.vsphere_virtual_machine.template_from_ovf.disks.0.size)}"
eagerly_scrub = "${data.vsphere_virtual_machine.template_from_ovf.disks.0.eagerly_scrub}"
thin_provisioned = "${data.vsphere_virtual_machine.template_from_ovf.disks.0.thin_provisioned}"
}
cdrom {
client_device = true
}
vapp {
properties = {
hostname = "${var.vm_name}"
public-keys = "${file(var.ssh_public_key_path)}"
user-data = "${base64encode(data.template_file.user_data.rendered)}"
}
}
clone {
template_uuid = "${data.vsphere_virtual_machine.template_from_ovf.id}"
}
}
output "ip_address" {
value = "${vsphere_virtual_machine.vm.default_ip_address}"
}
SSH 공개 키 만들기
로컬 노트북 또는 워크스테이션에서 관리자 워크스테이션에 SSH로 연결할 수 있도록 SSH 공개 키를 만듭니다. Linux 기반 운영체제에서는 ssh-keygen을 사용할 수 있습니다.
환경이 프록시를 이면에 있는 경우 다음 섹션을 수행하여 Google Cloud CLI와 Docker에서 프록시를 사용하도록 구성합니다.
프록시를 사용하도록 Google Cloud CLI 구성
관리자 워크스테이션 VM에서 다음 단계를 완료합니다.
노트북이나 워크스테이션에서 인터넷에 연결하도록 프록시를 사용하는 경우 gcloud 및 gsutil 명령어를 실행할 수 있도록 프록시용 Google Cloud CLI를 구성해야 합니다. 자세한 내용은 gcloud CLI를 프록시/방화벽 뒤에서 사용할 수 있도록 구성을 참조하세요.
프록시를 가져오도록 Docker 레지스트리 구성
관리자 워크스테이션 VM에서 다음 단계를 완료합니다.
Docker 레지스트리를 사용하고 네트워크가 프록시 뒤에서 실행되도록 하려면 프록시를 통해 이미지를 가져오도록 관리자 워크스테이션에서 실행되는 Docker 데몬을 구성해야 합니다.
HTTP 및 HTTPS 프록시의 주소를 수집합니다.
다음을 포함하여 프록시 없이 연락해야 하는 모든 호스트의 IP 주소와 호스트 이름을 수집합니다.
vCenter Server IP 주소
모든 ESXi 호스트의 IP 주소
부하 분산기에서 구성하려는 IP 주소
192.168.0.0/16 범위
관리자 워크스테이션에서 이 주소를 no_proxy 변수에 추가합니다.
printf -v no_proxy '%s,' [ADDRESSES];
원하는 경우 나중에 참조할 수 있도록 환경 변수로 범위를 내보낼 수 있습니다. 애플리케이션과 프로세스에서 다음 변수를 사용할 수 있습니다.
export no_proxy="${no_proxy%,}";
설정에 따라 /root/.docker/config.json, /home/ [USER]/.docker/config.json 또는 다른 곳에 저장된 Docker의 구성 파일을 엽니다.
GKE On-Prem은 Terraform의 vSphere 제공업체를 이용하여 vSphere 환경에 VM을 가져옵니다. 제공업체의 세션 한도는 1,000개입니다. 현재 구현은 사용 후 활성 세션을 닫지 않습니다. 실행 중인 세션이 너무 많으면 503 오류가 발생할 수 있습니다.
세션은 300초 후 자동으로 닫힙니다.
증상
실행 중인 세션이 너무 많으면 다음과 같은 오류가 발생할 수 있습니다.
Error connecting to CIS REST endpoint: Login failed: body:
{"type":"com.vmware.vapi.std.errors.service_unavailable","value":
{"messages":[{"args":["1000","1000"],"default_message":"Sessions count is
limited to 1000. Existing sessions are 1000.",
"id":"com.vmware.vapi.endpoint.failedToLoginMaxSessionCountReached"}]}},
status: 503 Service Unavailable
가능한 원인
환경에서 실행 중인 Terraform 제공업체 세션이 너무 많습니다.
해결 방법
이는 현재 정상적인 작동입니다. 세션은 300초 후 자동으로 닫힙니다. 자세한 내용은 GitHub 문제 #618을 참조하세요.
Docker용 프록시 사용: oauth2: cannot fetch token
증상
프록시를 사용하는 동안 다음 오류가 발생할 수 있습니다.
oauth2: cannot fetch token: Post https://oauth2.googleapis.com/token: proxyconnect tcp: tls: oversized record received with length 20527
가능한 원인
HTTP 대신 HTTPS 프록시를 제공했을 수 있습니다.
해결 방법
Docker 구성에서 프록시 주소를 https:// 대신 http://로 변경합니다.
라이선스가 올바른지 확인
특히 평가판 라이선스를 사용할 때는 해당 라이선스가 올바른지 확인해야 합니다. F5, ESXi 호스트, vCenter 라이선스가 만료되면 예기치 않은 오류가 발생할 수 있습니다.