Kops create cluster

kops create cluster

Create a Kubernetes cluster.

Synopsis

Create a Kubernetes cluster using command line flags. This command creates cloud based resources such as networks and virtual machines. Once the infrastructure is in place Kubernetes is installed on the virtual machines.

These operations are done in parallel and rely on eventual consistency.

  1. kops create cluster [CLUSTER] [flags]

Examples

  1. # Create a cluster in AWS in a single zone.
  2. kops create cluster --name=k8s-cluster.example.com \
  3. --state=s3://my-state-store \
  4. --zones=us-east-1a \
  5. --node-count=2
  6. # Create a cluster in AWS with High Availability masters. This cluster
  7. # has also been configured for private networking in a kops-managed VPC.
  8. # The bastion flag is set to create an entrypoint for admins to SSH.
  9. export KOPS_STATE_STORE="s3://my-state-store"
  10. export MASTER_SIZE="c5.large"
  11. export NODE_SIZE="m5.large"
  12. export ZONES="us-east-1a,us-east-1b,us-east-1c"
  13. kops create cluster k8s-cluster.example.com \
  14. --node-count 3 \
  15. --zones $ZONES \
  16. --node-size $NODE_SIZE \
  17. --master-size $MASTER_SIZE \
  18. --master-zones $ZONES \
  19. --networking cilium \
  20. --topology private \
  21. --bastion="true" \
  22. --yes
  23. # Create a cluster in Digital Ocean.
  24. export KOPS_STATE_STORE="do://my-state-store"
  25. export ZONES="NYC1"
  26. kops create cluster k8s-cluster.example.com \
  27. --cloud digitalocean \
  28. --zones $ZONES \
  29. --master-zones $ZONES \
  30. --node-count 3 \
  31. --yes
  32. # Generate a cluster spec to apply later.
  33. # Run the following, then: kops create -f filename.yaml
  34. kops create cluster --name=k8s-cluster.example.com \
  35. --state=s3://my-state-store \
  36. --zones=us-east-1a \
  37. --node-count=2 \
  38. --dry-run \
  39. -oyaml > filename.yaml

Options

  1. --admin-access strings Restrict API access to this CIDR. If not set, access will not be restricted by IP. (default [0.0.0.0/0,::/0])
  2. --api-loadbalancer-class string Class of loadbalancer for the Kubernetes API (AWS only): classic or network
  3. --api-loadbalancer-type string Type of loadbalancer for the Kubernetes API: public or internal
  4. --api-ssl-certificate string ARN of the SSL Certificate to use for the Kubernetes API loadbalancer (AWS only)
  5. --associate-public-ip Specify --associate-public-ip=[true|false] to enable/disable association of public IP for master ASG and nodes. Default is 'true'.
  6. --authorization string Authorization mode: AlwaysAllow or RBAC (default "RBAC")
  7. --bastion Enable a bastion instance group. Only applies to private topology.
  8. --channel string Channel for default versions and configuration to use (default "stable")
  9. --cloud string Cloud provider to use - aws, digitalocean, openstack
  10. --cloud-labels string A list of key/value pairs used to tag all instance groups (for example "Owner=John Doe,Team=Some Team").
  11. --container-runtime string Container runtime to use: containerd, docker
  12. --disable-subnet-tags Disable automatic subnet tagging
  13. --dns string DNS type to use: public or private (default "Public")
  14. --dns-zone string DNS hosted zone (defaults to longest matching zone)
  15. --dry-run If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.
  16. --encrypt-etcd-storage Generate key in AWS KMS and use it for encrypt etcd volumes
  17. --etcd-storage-type string The default storage type for etcd members
  18. --gce-service-account string Service account with which the GCE VM runs. Warning: if not set, VMs will run as default compute service account.
  19. -h, --help help for cluster
  20. --image string Machine image for all instances
  21. --kubernetes-version string Version of kubernetes to run (defaults to version in channel)
  22. --master-count int32 Number of masters. Defaults to one master per master-zone
  23. --master-image string Machine image for masters. Takes precedence over --image
  24. --master-public-name string Domain name of the public Kubernetes API
  25. --master-security-groups strings Additional precreated security groups to add to masters.
  26. --master-size string Machine type for masters
  27. --master-tenancy string Tenancy of the master group (AWS only): default or dedicated
  28. --master-volume-size int32 Instance volume size (in GB) for masters
  29. --master-zones strings Zones in which to run masters (must be an odd number)
  30. --network-cidr string Network CIDR to use
  31. --networking string Networking mode. kubenet, external, weave, flannel-vxlan (or flannel), flannel-udp, calico, canal, kube-router, amazonvpc, cilium, cilium-etcd, cni, lyftvpc. (default "kubenet")
  32. --node-count int32 Total number of worker nodes. Defaults to one node per zone
  33. --node-image string Machine image for worker nodes. Takes precedence over --image
  34. --node-security-groups strings Additional precreated security groups to add to worker nodes.
  35. --node-size string Machine type for worker nodes
  36. --node-tenancy string Tenancy of the node group (AWS only): default or dedicated
  37. --node-volume-size int32 Instance volume size (in GB) for worker nodes
  38. --os-dns-servers string comma separated list of DNS Servers which is used in network
  39. --os-ext-net string External network to use with the openstack router
  40. --os-ext-subnet string External floating subnet to use with the openstack router
  41. --os-kubelet-ignore-az Attach volumes across availability zones
  42. --os-lb-floating-subnet string External subnet to use with the kubernetes api
  43. --os-network string ID of the existing OpenStack network to use
  44. --os-octavia Use octavia loadbalancer API
  45. --out string Path to write any local output
  46. -o, --output string Output format. One of json or yaml. Used with the --dry-run flag.
  47. --project string Project to use (must be set on GCE)
  48. --ssh-access strings Restrict SSH access to this CIDR. If not set, uses the value of the admin-access flag.
  49. --ssh-public-key string SSH public key to use
  50. --subnets strings Shared subnets to use
  51. --target string Valid targets: direct, terraform, cloudformation. Set this flag to terraform if you want kOps to generate terraform (default "direct")
  52. -t, --topology string Network topology for the cluster: public or private (default "public")
  53. --utility-subnets strings Shared utility subnets to use
  54. --vpc string Shared VPC to use
  55. -y, --yes Specify --yes to immediately create the cluster
  56. --zones strings Zones in which to run the cluster

Options inherited from parent commands

  1. --add_dir_header If true, adds the file directory to the header of the log messages
  2. --alsologtostderr log to standard error as well as files
  3. --config string yaml config file (default is $HOME/.kops.yaml)
  4. --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
  5. --log_dir string If non-empty, write log files in this directory
  6. --log_file string If non-empty, use this log file
  7. --log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
  8. --logtostderr log to standard error instead of files (default true)
  9. --name string Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
  10. --one_output If true, only write logs to their native severity level (vs also writing to each lower severity level)
  11. --skip_headers If true, avoid header prefixes in the log messages
  12. --skip_log_headers If true, avoid headers when opening log files
  13. --state string Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
  14. --stderrthreshold severity logs at or above this threshold go to stderr (default 2)
  15. -v, --v Level number for the log level verbosity
  16. --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

SEE ALSO

  • kops create - Create a resource by command line, filename or stdin.