KubeKit needs access to the platform to create/provision all the instances or VMs. Unset $(env | grep KUBEKIT_VAR_ | cut -f1 -d= ) # now it's save to assign the variables 1.6.2. For example, to set the number of CPU's in a default_node_pool or the number of worker nodes, use something like this: To assign a value to some of these parameters you have to separate them with double underscore ( _), in some computer languages it's common to use a dot or other separator but in bash the only characters allowed are alphanumeric and underscore. If you look at the configuration file, in the platform or config section there are some parameters inside section or structure, for example default_node_pool or node_pools and workers. The variable is not case sensitive so could be uppercase, lowercase or mix of both. The environment variables should begin with KUBEKIT_VAR_ followed by the parameter name. In this case, use environment variables to provide the parameters but this should be done before editing the file or use the command update if the configuration file already exists. Sometimes it's difficult or impossible to edit the file, for example, when you are using KubeKit in a bash script or creating a cluster with Jenkins. b) Set parameters with environment variables Kubekit edit kubedemo -r | grep -v vsphere_username | grep -v vsphere_password 1.6.2. It's in Beta and at this time behaves like raw platform. This will install Kubernetes on custom EC2 instances KubeKit can provision and configure Kubernetes on the following platforms: Modify the values of PLATFORM, NAME, the parameters exporting the variable with prefix KUBEKIT_VAR_ plus the parameter name and then export the platform credentials. # 5) echo "To destroy the cluster execute: kubekit destroy $NAME " Kubekit describe $NAME eval $(kubekit get env $NAME ) echo "Cluster nodes: " Kubekit init $NAME -platform $PLATFORM # 3) echo "Creating the cluster " # 1) echo "Remove any previous KubeKit variable " unset $(env | grep KUBEKIT_VAR_ | cut -f1 -d= ) echo "Setting cluster parameters " export KUBEKIT_VAR_AWS_VPC_ID= 'vpc-8d56b9e9 ' export KUBEKIT_VAR_DEFAULT_NODE_POOL_AWS_SECURITY_GROUP_ID= 'sg-502d9a37 ' export KUBEKIT_VAR_DEFAULT_NODE_POOL_AWS_SUBNET_ID= 'subnet-5bddc82c ' echo "Setting AWS credentials " export AWS_ACCESS_KEY_ID= 'YOUR_AWS_ACCESS_KEY ' export AWS_SECRET_ACCESS_KEY= 'YOUR_AWS_SECRET_KEY ' export AWS_DEFAULT_REGION= 'us-west-2 ' # 2) echo "Initializing cluster configuration " If you are using KubeKit in a shell script this is a quick example of how to use it, this time is a cluster on AWS: Also, for a better user interface, send the logs to a file using the flag -log or configure KubeKit to do it as explained in section 1.2 and optionally use -debug if you are having issues. In this guide we use vSphere as example, for other platform just replace vsphere for the platform name and set the credentials to access platform API. Kubekit apply kubedemo -f kubekit-2.0.0.rpm -log kubedemo.log # -debug # 4) eval $(kubekit get env kubedemo ) # this is to export the KUBECONFIG variable # 1) export KUBEKIT_VAR_DATACENTER= 'Vagrant ' export KUBEKIT_VAR_DATASTORE= 'sd_labs_19_vgrnt_dsc/sd_labs_19_vgrnt03 ' export KUBEKIT_VAR_RESOURCE_POOL= 'sd_vgrnt_01/Resources/vagrant01 ' export KUBEKIT_VAR_VSPHERE_NET= 'dvpg_vm_550 ' export KUBEKIT_VAR_FOLDER= 'Discovered virtual machine/ja186051 ' export KUBEKIT_VAR_NODE_POOLS_WORKER_COUNT=3Įxport VSPHERE_SERVER= '153.64.33.152 ' export VSPHERE_USERNAME= ' export VSPHERE_PASSWORD= ' # 2) To download and install the edge version, it's required to have Go installed in your system. It's important for some clusters such as EKS to have KubeKit in a directory that is in the $PATH environment variable. Download the proper KubeKit binary for your operative system and architecture. How to fill the cluster configuration file for EC2īelow are the available downloads for the latest version of KubeKit ( 0.1.0).4.a) Provision a cluster on a cloudy platform.2.c) Set or export credential variables. 2.b) Set parameters with environment variables.KubeKit is a tool for setting up a Kubernetes-powered cluster.
0 Comments
Leave a Reply. |