Skip to main content

Retrieve Kube Config (Ingress)

If ingress endpoint is configured for the virtual cluster, you can retrieve the kube config for the virtual cluster through this endpoint

Example Virtual Cluster Kube Config​

An example Virtual Cluster Kube Config:

apiVersion: management.loft.sh/v1
kind: VirtualClusterInstanceKubeConfig
metadata:
creationTimestamp: null
namespace: your-namespace
spec: {}
status:
kubeConfig: |-
apiVersion: v1
kind: Config
clusters:
- cluster:
...

Virtual Cluster Kube Config Reference​

spec required object pro​

certificateTTL required integer pro​

CertificateTTL holds the ttl (in seconds) to set for the certificate associated with the returned kubeconfig. This field is optional, if no value is provided, the certificate TTL will be set to one day. If set to zero, this will cause loft to pass nil to the certificate signing request, which will result in the certificate being valid for the clusters cluster-signing-duration value which is typically one year.

status required object pro​

kubeConfig required string pro​

KubeConfig holds the final kubeconfig output

Virtual Cluster Kube Config (Create)​

Create a file object.yaml with the following contents:

apiVersion: management.loft.sh/v1
kind: VirtualClusterInstanceKubeConfig
metadata:
creationTimestamp: null
namespace: your-namespace
spec: {}
status:
kubeConfig: |-
apiVersion: v1
kind: Config
clusters:
- cluster:
...

Then run the following curl command:

# Exchange my-object in the url below with the name of the Virtual Cluster Kube Config
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/your-namespace/virtualclusterinstances/my-object/kubeconfig" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"