Kubernetes
From wiki.vacula.xyz
Concepts
Decoupling:
- run resources anywhere
- don't tie an application to a specific server
- don't store configuration within the application
Usage
# Create a deployment of 3 nginx services called "salesweb" kubectl create deployment salesweb --image=nginx:latest --replicas=3 # Create a service for the salesweb deployment to use port 80 inside the containers kubectl expose deployment salesweb --port=80 # Tell the ingress controller to redirect any traffic (including sub-paths) on "sales.example.com" to the salesweb service kubectl create ingress salesweb --rule="sales.example.com/*=salesweb:80"
Tips and Tricks
Don't write YAML files directly, generate them. Use kubectl create with the options --dry-run=client -o yaml to generate the YAML files. Alternatively, use a kubectl get command with -o yaml. Use kubectl apply -f to create or update resources from a YAML file.