Command 'juju add-k8s'
Usage:
juju add-k8s [options] <k8s name>
Summary:
Adds a k8s endpoint and credential to Juju.
Global Options:
--debug (= false)
Equivalent to --show-log --logging-config==DEBUG
-h, --help (= false)
Show help on a command or other topic.
--logging-config (= "")
Specify log levels for modules
--quiet (= false)
Show no informational output
--show-log (= false)
If set, write the log file to stderr
--verbose (= false)
Show more verbose output
Command Options:
-B, --no-browser-login (= false)
Do not use web browser for authentication
--aks (= false)
used when adding an AKS cluster
-c, --controller (= "")
Controller to operate in
--client (= false)
Client operation
--cloud (= "")
k8s cluster cloud
--cluster-name (= "")
Specify the k8s cluster to import
--context-name (= "")
Specify the k8s context to import
--credential (= "")
The credential to use when accessing the cluster
--eks (= false)
Used when adding an EKS cluster
--gke (= false)
Used when adding a GKE cluster
--project (= "")
Project to which the cluster belongs
--region (= "")
k8s cluster region or cloud/region
--resource-group (= "")
The Azure resource group of the AKS cluster
--skip-storage (= false)
Used when adding a cluster that doesn’t have storage
--storage (= "")
k8s storage class for workload storage
Details:
Creates a user-defined cloud based on a k8s cluster.
The new k8s cloud can then be used to bootstrap into, or it can be added to an existing controller.
Use --controller
option to add k8s cloud to a controller.
Use --client
option to add k8s cloud to this client.
Specify a non default kubeconfig file location using $KUBECONFIG environment variable or pipe in file content from stdin.
The config file can contain definitions for different k8s clusters,
use --cluster-name
to pick which one to use.
It’s also possible to select a context by name using --context-name.
When running add-k8s the underlying cloud/region hosting the cluster needs to be
detected to enable storage to be correctly configured. If the cloud/region cannot
be detected automatically, use either
--cloud <cloudType|cloudName>
to specify the host cloud
or
--region <cloudType|cloudName>/<someregion>
to specify the host
cloud type and region.
Region is strictly necessary only when adding a k8s cluster to a JAAS controller.
When using a standalone Juju controller, usually just --cloud
is required.
Once Juju is aware of the underlying cloud type, it looks for a suitably configured
storage class to provide operator and workload storage. If none is found, use
of the --storage
option is required so that Juju will create a storage class
with the specified name.
If the cluster does not have a storage provisioning capability, use the
--skip-storage
option to add the cluster without any workload storage configured.
When adding an AKS, EKS, or GKE cluster, you can use the --aks
, --eks
, or --gke
option to interactively be stepped through the registration process, or you can
supply the necessary parameters directly. For this to work, you’ll have to have az,
eksctl, or gcloud installed and logged in.
Examples:
When your kubeconfig file is in the default location:
juju add-k8s myk8scloud
juju add-k8s myk8scloud --client
juju add-k8s myk8scloud --controller mycontroller
juju add-k8s --context-name mycontext myk8scloud
juju add-k8s myk8scloud --region cloudNameOrCloudType/someregion
juju add-k8s myk8scloud --cloud cloudNameOrCloudType
juju add-k8s myk8scloud --cloud cloudNameOrCloudType --region=someregion
juju add-k8s myk8scloud --cloud cloudNameOrCloudType --storage mystorageclass
To add a Kubernetes cloud using data from your kubeconfig file, when this file is not in the default location:
KUBECONFIG=path-to-kubeconfig-file juju add-k8s myk8scloud --cluster-name=my_cluster_name
To add a Kubernetes cloud using data from kubectl, when your kubeconfig file is not in the default location:
kubectl config view --raw | juju add-k8s myk8scloud --cluster-name=my_cluster_name
To add a GKE cluster ‘myk8scloud’ after gcloud login:
juju add-k8s --gke myk8scloud
To add a GKE cluster specifying the project the cluster belongs to:
juju add-k8s --gke --project=myproject myk8scloud
To specify the credential to use when accessing the cluster:
juju add-k8s --gke --credential=myaccount --project=myproject myk8scloud
To specify the K8s cluster region or cloud/region:
juju add-k8s --gke --credential=myaccount --project=myproject --region=someregion myk8scloud
To add an AKS cluster named ‘myk8scloud’ after az login:
juju add-k8s --aks myk8scloud
To specify the cluster to import, when you have more than one cluster:
juju add-k8s --aks --cluster-name mycluster myk8scloud
To specify the Azure resource group of the AKS cluster:
juju add-k8s --aks --cluster-name mycluster --resource-group myrg myk8scloud
See also:
remove-k8s
Last updated 10 months ago.