Kops: Difference between revisions
From Federal Burro of Information
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== DUmp a cluster oncifg == | |||
there are two types of configs that make up a kops created cluster: | |||
1. the cluster config | |||
2. an instance group config, one for each instance group. | |||
THe easiest way to save a copy of this is to | |||
kops edit cluster | |||
then write the config to a file. | |||
== The Shiva == | == The Shiva == |
Revision as of 18:47, 4 December 2018
DUmp a cluster oncifg
there are two types of configs that make up a kops created cluster:
1. the cluster config
2. an instance group config, one for each instance group.
THe easiest way to save a copy of this is to
kops edit cluster
then write the config to a file.
The Shiva
# /bin/sh # Source: # https://kubernetes.io/docs/setup/custom-cloud/kops/ # route 53 domain registered and hosted: # check existing status: echo subdomain: ${subdomain} echo bucketconfig: ${bucketconfig} echo prefix ${prefix} echo cn: ${cn} echo pubkey ${pubkey} export subdomain="dev.thedomain.com" export bucketconfig="dthornton-clusters" export prefix="lab001" export cn="${prefix}.${subdomain}" # clustername export pubkey="~/.ssh/dthornton.pub" # check again: echo subdomain: ${subdomain} echo bucketconfig: ${bucketconfig} echo prefix ${prefix} echo cn: ${cn} echo pubkey ${pubkey} # does the bucket exist? aws s3api list-buckets --output table | grep ${bucketconfig}.${subdomain} # if not make a bucket: echo aws s3 mb s3://${bucketconfig}.${subdomain} # aws s3 mb s3://${bucketconfig}.${subdomain} # sync a local copy # aws s3 sync s3://${bucketconfig}.${subdomain} s3bucket export KOPS_STATE_STORE="s3://${bucketconfig}.${subdomain}" echo KOPS_STATE_STORE echo ${KOPS_STATE_STORE} # example: # kops create cluster --zones=us-east-1c useast1.dev.quadratic.net # cluster creation , chicken and egg: # this command makes the kops cluster object but fails to make all the aws cloud objects because there is no key to give the instances. kops create cluster --zones="ca-central-1a,ca-central-1b" "${cn}" kops create cluster \ --zones ca-central-1a,ca-central-1b \ --master-zones ca-central-1a \ --image ami-9526abf1 \ # latest ca-central-1 ubuntu Tue 18 Sep 2018 10:52:50 EDT --ssh-public-key ${pubkey} \ --node-size t2.medium \ --node-count 2 \ --master-size t2.medium \ --network-cidr 10.10.0.0/16 \ --dns-zone ${subdomain} \ --cloud-labels "owner=dthornton,managedby=kops" \ --name ${cn} \ --yes kube config is : /Users/david/.kube/config api url: https://api.${cn}/api/v1/nodes?limit=500 optional: kops update cluster --name $cn --yes Note that above we explicity tell it what public key to use at the outset. # now make a kube secret of type public key. This assumes you already have a private public pair and you are giving kops the public part so that it can give it to kubrnetes and AWS. # kops create secret --name ${cn} sshpublickey admin -i ~/.ssh/${pubkey} # kops edit cluster ${cn} # ig = instance group kops edit ig --name=${cn} nodes kops edit ig --name=${cn} master-ca-central-1a #Suggestions: # * validate cluster: kops validate cluster # * list nodes: kubectl get nodes --show-labels # * ssh to the master: ssh -i ~/.ssh/id_rsa admin@api.cacentral.dev.quadratic.net # * the admin user is specific to Debian. If not using Debian please use the appropriate user based on your OS. # * read about installing addons at: https://github.com/kubernetes/kops/blob/master/docs/addons.md. kops update cluster ${cn} --yes kops rolling-update cluster # specify some stuff at creation: #kops create cluster \ #--master-zones=us-east-1a,us-east-1b,us-east-1c \ #--zones=us-east-1a,us-east-1b,us-east-1c \ #--node-count=2 \ #--image ami-32705b49 \ #${cn} kubectl -n kube-system get po set name spae to kube-system get pods # Note that the kops destroy cleans out the kubectl config file: "/Users/david/.kube/config" kops delete cluster ${cn} --yes
Also see
- Kubernetes - what you gone do?