Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set availability zones for VPC in eksctl config file?

When creating a cluster using eksctl on the command line, one can specify availability zones using the "zones" flag, like so:

eksctl create cluster \
--name example \
--version 1.16 \
--region us-east-1 \
--zones us-east-1a,us-east-1b,us-east-1c

In the eksctl documentation, it is noted that configuration files are more flexible than flags. However, eksctl configuration file options are poorly documented, and there is no way to generate config files from flags.

The eksctl repo provides is an example that uses an existing VPC with predefined subnets, but this provides no visibility into how the same settings relate to de novo VPCs. It is also much more fine-grained than what is necessary with the flags.

If one were highly proficient in golang (and very patient), one could figure it out from source, but IMO this defeats the purpose of a turnkey solution like eksctl.

Is there a way to use a config file to achieve what is achieved in the flag example above? If so, how?

like image 953
David Bruce Borenstein Avatar asked May 27 '20 17:05

David Bruce Borenstein


People also ask

Does Eksctl create VPC?

By default eksctl create cluster will create a dedicated VPC for the cluster. This is done in order to avoid interference with existing resources for a variety of reasons, including security, but also because it is challenging to detect all settings in an existing VPC. The default VPC CIDR used by eksctl is 192.168.

What is the difference between Kubectl and Eksctl?

kubectl – A command line tool for working with Kubernetes clusters. This guide requires that you use version 1.23 or later. For more information, see Installing or updating kubectl. eksctl – A command line tool for working with EKS clusters that automates many individual tasks.

What is Eksctl?

eksctl is a simple CLI tool for creating and managing clusters on EKS - Amazon's managed Kubernetes service for EC2. It is written in Go, uses CloudFormation, was created by Weaveworks and it welcomes contributions from the community.


1 Answers

This is a yaml that i used a few days ago to build a cluster with eksctl:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: myname
  region: us-east-1

nodeGroups:
  - name: ng-1
    labels:  
      worker: default
    instanceType: m5.xlarge
    desiredCapacity: 1
    minSize: 1
    maxSize: 10
availabilityZones: ['us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1d']
like image 196
paltaa Avatar answered Sep 27 '22 21:09

paltaa