Using CheatSheets To Apply Best Practices

Cheatsheet: Kubernetes Cluster API

Cheatsheet: Kubernetes Cluster API

1.1 Cluster API – Basic

Name Summary
Cluster API Project Milestone v1alpha1(Due by 03/29/2019)
Key Initiatives Declarative infra; CRD design model; Resource LCM
CAL (cloud abstraction layer)  
Boostrap cluster minikube by default
Machine Object Machine CRD
Cluster Object  
clusterctl GitHub: cluster-api/cmd/clusterctl, Might be merged into kubectl directly
Demo Video: vSphere Clsuter-API provider: self-service

1.2 Concepts

Core Kubernetes Cluster API
Pod Machine
ReplicaSet MachineSet
Deployment MachineDeployment

1.3 Components

Name Summary
API Spec Link: Kubernetes Cluster Management API
2 pods in guest k8s clusters cluster api controller, cloud provider controller
Reference GitHub: kubernetes-sigs/cluster-api

1.4 Commands

Name Summary
Deploy a k8s cluster clusterctl create cluster -p provider-components.yaml -c cluster.yaml -m machines.yaml --provider vsphere -e ~/.kube/config
Delete a k8s cluster clusterctl delete cluster --kubeconfig=kubeconfig -p provider-components.yaml --bootstrap-type kind
List all kind clusters kind get clusters
Delete kind cluster kind delete cluster --name clusterapi
Create kind clusrer kind create cluster --name clusterapi
SSH to K8S master/worker vm ssh -i /root/.ssh/vsphere_tmp ubuntu@$vm_ip
kubeconfig in new k8s clusters /etc/kubernetes/admin.conf in master VM

1.5 Cluster API Providers – vsphere

Name Summary
Check controller log kubectl logs -n vsphere-provider-system vsphere-provider-controller-manager-0 -f
Vsphere GitHub: Vsphere Example Files

1.6 Cluster API Related Works

Name Summary
SAP gardener  
Gardener with cluster api GitHub Issue: Adopt Cluster API Spec

1.7 clusterctl cli Online Help

> go/src/ > ./bin/clusterctl create cluster --help

I0311 17:25:43.924329   50076 machineactuator.go:811] Using the default GCP client
Create a kubernetes cluster with one command

  clusterctl create cluster [flags]

  -a, --addon-components string               A yaml file containing cluster addons to apply to the internal cluster
      --bootstrap-cluster-cleanup             Whether to cleanup the bootstrap cluster after bootstrap. (default true)
  -e, --bootstrap-cluster-kubeconfig string   Sets the bootstrap cluster to be an existing Kubernetes cluster.
      --bootstrap-flags strings               Command line flags to be passed to the chosen bootstrapper
      --bootstrap-type string                 The cluster bootstrapper to use. (default "none")
  -c, --cluster string                        A yaml file containing cluster object definition. Required.
  -h, --help                                  help for cluster
      --kubeconfig-out string                 Where to output the kubeconfig for the provisioned cluster (default "kubeconfig")
  -m, --machines string                       A yaml file containing machine object definition(s). Required.
      --provider string                       Which provider deployment logic to use (google/vsphere/azure). Required.
  -p, --provider-components string            A yaml file containing cluster api provider controllers and supporting objects. Required.

Global Flags:
      --alsologtostderr                  log to standard error as well as files
      --kubeconfig string                Paths to a kubeconfig. Only required if out-of-cluster.
      --log-flush-frequency duration     Maximum number of seconds between log flushes (default 5s)
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --log_file string                  If non-empty, use this log file
      --logtostderr                      log to standard error instead of files (default true)
      --master string                    The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
      --skip_headers                     If true, avoid header prefixes in the log messages
      --stderrthreshold severity         logs at or above this threshold go to stderr
  -v, --v Level                          number for the log level verbosity
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

1.8 More Resources

License: Code is licensed under MIT License.

Leave a Reply

Your email address will not be published. Required fields are marked *