Athena

Kubernetes Primer

Minimal Kubernetes concepts and commands needed to use athena-operator.

You do not need deep Kubernetes expertise to use this operator, but you do need a few terms and commands.

Core Concepts

  • Cluster: where Kubernetes runs workloads
  • Namespace: a folder-like partition inside the cluster
  • Pod: a running unit, usually one container
  • Deployment: keeps Pods running and replaces failed instances
  • Service: stable DNS name and port routing to Pods
  • Secret: key-value storage for sensitive configuration
  • CRD: Custom Resource Definition that adds new Kubernetes kinds
  • Operator: controller that watches CRDs and creates or updates other resources

Commands You Will Use Constantly

Which cluster am I talking to?

  • kubectl config current-context
  • kubectl get nodes

What exists right now?

  • kubectl get ns
  • kubectl get pods -A
  • kubectl get deploy,svc -n <namespace>

Apply YAML

  • kubectl apply -f <file-or-folder>

Inspect details

  • kubectl describe <type> <name> -n <namespace>
  • kubectl get <type> <name> -n <namespace> -o yaml

Logs

  • kubectl logs -n <namespace> deploy/<deployment-name> -f

Events

  • kubectl get events -A --sort-by=.lastTimestamp

Secrets And Base64

In Kubernetes YAML, Secret.data values must be base64-encoded.

On Windows PowerShell:

[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('hello'))

If you do not want to hand-encode values, create the secret with kubectl instead:

kubectl create secret generic my-secret -n my-ns --from-literal=mykey=myvalue

You can inspect what Kubernetes created with:

kubectl get secret my-secret -n my-ns -o yaml