Skip to content

Alpha Cluster Administration

James Lott edited this page Feb 23, 2017 · 8 revisions

Configure kubectl on workstation

The cluster can be managed entirely from a local workstation using the kubectl command. These instructions assume kubectl has already been installed on the workstation in question.

The steps to use the shared kubectl configuration are as follows:

  1. Decrypt kubectl configuration
  2. Place decrypted configuration in kubectl config directory
  3. Verify kubectl can connect to the cluster

From within the ops repo directory:

(
  set -e
  gpg -do kubectl.kubeconfig kubernetes/alpha-cluster/workstation-resources/kubectl.kubeconfig.asc
  test -e ~/.kube || mkdir ~/.kube
  mv -i kubectl.kubeconfig ~/.kube/config
  kubectl get nodes
)

Create and expose container volume

Creating and exposing new volumes for use by containers is a two step process:

  1. Create volume on NFS server
  2. Create kubernetes PersistentVolume resource which can be claimed

Create volume on NFS server

All container volumes should be contained within a top level volume which bears the container's name. The top level volume does not need any special properties applied to it; its only purpose is for hierarchical organization. For example, if a container named "nginx" has two volumes, one for config files and one for publicly served files, the volume hierarchy should look like:

kubvols/nginx
kubvols/nginx/configs
kubvols/nginx/html

Each subvolume of a container should be configured with the following ZFS properties:

  • quota=AMOUNT: Appropriate amount may vary based on container and purpose, but each volume should be given a quota
  • compression=lz4: Highly efficient compression helps make the most of available space
  • sharenfs=on: Export the volume as a NFS share

The specific steps to creating new container volumes are as follows:

  1. Create top level container volume if necessary. Otherwise, move on to step 2.
  2. Create purpose-specific subvolume

Before copy/pasting, set shell variables:

  • container_name: Name of container volumes belong to
  • volume_name: Name of specific volume being created
  • quota_size: A quota for the volume; e.g., 5GB, 512MB, etc
(
  set -e
  zfs get "kubvols/${container_name?}" >/dev/null 2>&1 || zfs create "kubvols/${container_name?}"
  zfs create -o quota=${quota_size?} -o compression=lz4 -o sharenfs=on "kubvols/${container_name?}/${volume_name?}"
)

Clone this wiki locally