Search code examples
kuberneteskubectlkops

Kops - Provisioning & Configuration on AWS


Novice to provisioning resources & configuration for kubernetes setup.

Registered a domain & subdomain with GoDaddy.

Installed kops & kubectl in EC2 instance.

Created a bucket for this cluster to store configuration

I ran below command on AWS EC2 instance:

kops create cluster --cloud=aws --zones=us-east-1b  \
—dns-zone=subdomain.domain-aws.com  \
—name=cluster1.subdomain.domain-aws.com --yes

My understanding is:

1) kops performs provisioning of AWS services(resources) for a two node cluster. VPC, subnets, auto-scaling, EC2(hosting master & nodes) etc...

2) kops creates the configuration file of this provisioning & stores it in KV cluster store of master

3) kops configure cluster store, apiserver, controller, scheduler installations in master

4) kops configures kubelet, container engine & kube-proxy on each node.


kubectl is a client for apiserver, that talks to API server and performs tasks to create PODS, get information about cluster etc..

Questions

1) How does kops remember the state of provisioning & cluster configuration, if I need to later upgrade & configure the cluster? state maintenance...

2) How to view the current cluster provisioning & configuration, done by kops? as a configuration file..


Solution

  • 1) kops performs provisioning of AWS services(resources) for a two node cluster. VPC, subnets, auto-scaling, EC2(hosting master & nodes) etc...

    This is generally correct. A couple points: it doesn't have to be a two node cluster, for instance you can specify the desired number of nodes with the --node-count; also, it doesn't directly create any EC2 VMs for you, it creates autoscaling groups (ASGs) and those ASGs are "responsible" for creating and maintaining the desired number of master and worker VMs.

    2) kops creates the configuration file of this provisioning & stores it in KV cluster store of master

    Unless this behaviour has changed recently, no, the configuration settings are stored in bucket you created to store configuration. See these docs.

    3) kops configure cluster store, apiserver, controller, scheduler installations in master

    4) kops configures kubelet, container engine & kube-proxy on each node.

    As above, unless this changed recently, kops does not install the cluster store on the master. It does configure apiserver and scheduler installations on the master nodes. You can see more of what gets installed on masters and workers, and how these are installed, in these docs

    Based on those docs, looks like the masters have the following:

    • kube-apiserver
    • kube-controller-manager (which runs miscellaneous controllers)
    • kube-scheduler (which assigns pods to nodes)
    • etcd
    • dns-controller

    and on workers:

    • kube-proxy (which configures iptables so that the k8s-network will work)
    • kubelet
    • Docker

    and perhaps Docker can be swapped out for other container engines?

    kubectl is a client for apiserver, that talks to API server and performs tasks to create PODS, get information about cluster etc..

    Yes.

    1) How does kops remember the state of provisioning & cluster configuration, if I need to later upgrade & configure the cluster? state maintenance...

    That is stored in the "state store" which is typically an S3 bucket, like the one you said you provisioned to store configuration. You can look at the kops docs for how to do things like perform upgrades, change configuration, scale up the Kubernetes cluster, etc. You don't need to edit the files in the buckets directly, kops has commands for most of those operations.

    2) How to view the current cluster provisioning & configuration, done by kops? as a configuration file..

    These docs have some info. For example, you could run:

    kops get cluster1.subdomain.domain-aws.com
    

    In general, I think searching and reading the docs would be very helpful for you in answering these questions and future questions you may have in understanding and using kops.