kubernetes can't store data at section VirtualCenter, subsection variable insecure-flag

3/23/2020

I'm setting the PVC on Kubernetes use vSphere cloud provider with self signed certificate, I tried put the flag insecure-flag = "1" on my vsphere.conf, but I get this error:

F0320 14:55:19.410777       1 controllermanager.go:213] error building controller context: cloud provider could not be initialized: could not init cloud provider "vsphere": warning:can't store data at section "VirtualCenter", subsection "vsphere-node01", variable "insecure-flag"

Environment:

Linux version: Red Hat 7.7 (Maipo)

Kubernetes version: v1.17.2

Vsphere version: 6.5.0

Can anyone help me with this problem?

-- nascimse
kubernetes
vsphere

1 Answer

4/27/2020

This issue was solved with the link information: https://vmware.github.io/vic-product/assets/files/html/1.3/vic_vsphere_admin/obtain_thumbprint.html

vCenter Server Appliance or ESXi Host You can use SSH and OpenSSL to obtain the certificate thumbprint for a vCenter Server Appiance instance or an ESXi host.

Use SSH to connect to the vCenter Server Appliance or ESXi host as root user.

$ ssh root@vcsa_or_esxi_host_address
    Use openssl to view the certificate fingerprint.

vCenter Server Appliance:

openssl x509 -in /etc/vmware-vpx/ssl/rui.crt -fingerprint -sha1 -noout

    Result: SHA1 Fingerprint=G5:2T:G4:4E:FE:32:D1:24:4F:25:39:GR:63:19:2B:5D:29:D1:R1:2C

ESXi host:

openssl x509 -in /etc/vmware/ssl/rui.crt -fingerprint -sha1 -noout
    Result: SHA1 Fingerprint=G5:2T:G4:4E:FE:32:D1:24:4F:25:39:GR:63:19:2B:5D:29:D1:R1:2C

Copy the certificate thumbprint for use in the --thumbprint option of vic-machine commands or to set it as an environment variable.

On the vsphere.conf file put this information on "thumbprint"

[Global]

[VirtualCenter "host.net"]
user = "administrator@vsphere.local"
password = "XYZ@!xyz"
port = "443"
thumbprint = "G5:2T:G4:4E:FE:32:D1:24:4F:25:39:GR:63:19:2B:5D:29:D1:R1:2C"
datacenters = "dc-vcenter"  

[Workspace]
server = "host.net"
datacenter = "dc-vcenter"
default-datastore = "ds-vcenter"
resourcepool-path = "rs-vcenter/rp-app"
folder = "kubevol"

[Disk]
scsicontrollertype = pvscsi

This setting will allow the kubernetes API connect to vSphere and make authentication with a self signed certificate.

-- nascimse
Source: StackOverflow