Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2.63 KB

k8s-101.md

File metadata and controls

83 lines (59 loc) · 2.63 KB

1 minute Kubernetes 101

Below is the very basics you need for kubernetes. See https://kubernetes.io/docs/tutorials/ for more info

pods, deployments, and services

Pods, deployments, and services are the basics you need to know when deploying to kubernetes. They are what define your containerized application and how it is ran in kubernetes. They are configured in yaml or json. Here is an example of a Deployment definition:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-slalom
  labels:
    app: go-slalom
spec:
  replicas: 1
  selector:
    matchLabels:
     app: go-slalom
  template:
    metadata:
      labels:
        app: go-slalom
    spec:
      containers:
      - name: go-slalom
        image: go-slalom
        command:
          - go-slalom
          - start
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
  • pod: A pod is a group of 1 or more containers. Usually it's a single container and configures the image used to run that container. You can directly deploy pod definition to kubernetes, but usually you will define a deployment.

  • deployments: Group identical pods and define their lifecycle and scaling. Killing, restarting, update strategies, etc

  • service: A service is a selection of like pods. It abstracts how the pods, and thus your application, are accessed (either in the cluster or from outside). While pods may live and die, the service persists until you destroy it.

service

namespaces

Namespaces provide a scope for names and creating resources.

They are important for isolating resources when necessary

They are often used as environments (e.g. separate dev, uat, prod namespaces)

configmaps

Configmaps are used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.

Configmaps are often used as an "environment profile"

apiVersion: v1
kind: ConfigMap
metadata:
  name: go-slalom
data:
  # property-like keys; each key maps to a simple value
  magic_value: "beer"

secrets

Secrets are similar to configmaps but used for confidential data. Their values can be mapped to pods in the same way as configmaps. Kubernetes provides a friendly way for you to securely store and edit secrets. They and often used for user credentials, api keys, etc

kubectl

kubectl is the cli you will frequently use to manage applications in kubernetes. However, you can also manage applications in a kubernetes dashboard.

Next

Why Go?

k8s-and-gopher