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
Virtual Cluster Kube Config example​
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 ​
spec
required object ​certificateTTL
required integer ​
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.
certificateTTL
required integer ​cluster-signing-duration
value
which is typically one year.server
required string ​
Server allows user to override server in the kubeconfig.
server
required string ​clientCert
required boolean ​
ClientCert, if set to true, will return kube config with generated client certs instead of platform token
clientCert
required boolean ​status
required object ​
status
required object ​kubeConfig
required string ​
KubeConfig holds the final kubeconfig output
kubeConfig
required string ​Virtual Cluster Kube Config (Create)​
- curl
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"