Kubernetes Learning Outline For Mac
1. Environment Setup
File: N/A
Description: Install kubectl and a local Kubernetes cluster like Minikube.
brew install kubectl brew install minikube
2. Basic Commands
File: N/A
Description: Familiarize yourself with Kubernetes' basic commands.
kubectl get pods kubectl describe pod
3. Simple Deployment
File: simple-deployment.yaml
Description: Create a simple Kubernetes Deployment.
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: nginx
image: nginx:1.14.2
4. Services
File: service.yaml
Description: Expose your application with a Service.
yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- protocol: TCP
port: 80
targetPort: 80
5. ConfigMaps and Secrets
File: configmap.yaml and secret.yaml
Description: Manage configuration data and secrets.
yaml # configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: app-config data: some-key: "some-value" # secret.yaml apiVersion: v1 kind: Secret metadata: name: app-secret type: Opaque data: password: dGhpc2lzYXNlY3JldA==
6. Persistent Storage
File: persistent-volume.yaml and persistent-volume-claim.yaml
Description: Learn how to use persistent storage with Kubernetes.
yaml
# persistent-volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: my-pv
spec:
capacity:
storage: 10Gi
# persistent-volume-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
resources:
requests:
storage: 5Gi
7. StatefulSets
File: statefulset.yaml
Description: Use StatefulSets for stateful applications.
yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
serviceName: "nginx"
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: k8s.gcr.io/nginx-slim:0.8
8. Helm Charts
File: Various .yaml files in a Helm chart directory
Description: Learn how to use Helm for package management.
9. Custom Resource Definitions (CRDs)
File: custom-resource-definition.yaml
Description: Extend Kubernetes by defining your own resources.
10. Networking, RBAC, and Advanced Topics
File: Varies
Description: Dive into advanced topics like networking, Role-Based Access Control (RBAC), and cluster maintenance.