Skip to content

Alpha Cluster Administration

James Lott edited this page Mar 21, 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
)

Access cluster services via kubectl

The alpha cluster runs several services, including web accessible resources such as kibana and grafana. Access to these resources must be proxied through the kubernetes master using kubectl. The steps to access a service are as follows, and access to the kibana dashboard is used in the example.

  1. Acquire proxy information for cluster services
  2. Open proxy to kubernetes master
  3. Access resource via HTTP proxy

Note: This example is illustrative, and is no good for copy/paste

$ kubectl cluster-info
Kubernetes master is running at https://kubmaster01:443
Elasticsearch is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging
Heapster is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/heapster
Kibana is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/kibana-logging
KubeDNS is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/kube-dns
Grafana is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
InfluxDB is running at https://kubmaster01:443/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb
# This command will block until you send SIGINT
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
# Now you would access http://127.0.0.1/api/v1/proxy/namespaces/kube-system/services/kibana-logging from your browser

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

In order to create a new volume for a container, define the container volume in the pillar of whichever storage machine will house the volume, then highstate the machine.

Create PersistentVolume resource

The creation of these resources is automated based on the pillar used to create the container volume on the NFS server. From the master, ensure pillar has been enabled and perform a highstate to create and update these resources.

(
  set -e
  test -e /srv/pillar || ln -s /ops/kubernetes/alpha-cluster/pillar /srv/pillar
  salt-call --local state.highstate
)

Clone this wiki locally