Kubernetes Notes
Questions
- How would I put a deployment on a different physical subnet than the cluster? Is this possible?
Namespace
- virtual cluster
- used for organizing apps
- volumes are available globally
- kubens – tool for changing namespace so that you don’t have to provide flag when command is run
Ingress
- LoadBalancer == external service
- External service has targetport and nodeport
- Internal service has no nodeport
- Entrypoint –> external server that forwards requests to cluster (proxy like traefik)
Helm
- Helm Charts – kind of like dockerhub but for kubernetes configurations
- Example, elastic stack is the same across most deployments so it is packaged in Helm
- Templating engine –> like jinja2
- Structure: mychart/ Chart.yaml values.yaml charts/ templates/
Service
Services use selectors which point to labels on pods for requests to be forwarded to
Config Files
Each config has API version and ‘Kind’ (deployment, service, etc) 2. Metadata 3. Specification (meat & potatoes) Template – config file inside config file
Persistent Volumes and PVCs
- Mount path configured under container via ‘volumeMount’
- PVC specified under ‘volumes’
- Persistent volume defined in its own file
1apiVersion: v1
2kind: Pod
3metadata:
4 name: my-pod
5spec:
6 containers:
7 - name: myfrontend
8 image: nginx
9 volumeMounts:
10 - MountPath: "/var/www/html"
11 name: my-data
12 volumes:
13 - name: my-data
14 persistentVolumeClaim:
15 claimName: my-pvc