API overview is here.
All the Kubernetes API reference is here.
All the kubectl commands reference is here.
kubectl run --restart=Never --image=busybox static-busybox --dry-run -o yaml --command -- sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml
Use JSON PATH query to retrieve the osImages of all the nodes and store it in a file /opt/outputs/nodes_os_x43kj56.txt
kubectl get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}' > /opt/outputs/nodes_os_x43kj56.txt
show
kubectl run nginx --generator=run-pod/v1 --image=nginx
show
kubectl run nginx --generator=run-pod/v1 --image=nginx --dry-run -o yaml > nginx.yaml
show
kubectl create deployment nginx --image=nginx --dry-run -o yaml > nginx-deployment.yaml
Open the nginx-deployment.yaml file that is created and modify replicas: 4
Create a Service named nginx of type NodePort to expose deployment nginx's port 80 on port 30080 on the nodes:
solusion 1
kubectl expose deploy nginx --type=NodePort --port=80 --dry-run -o yaml > nginx-service.yaml
Open and modify the file nginx-service.yaml, to add nodePort: 30080
solusion 2
Expose deployment nginx, this way the nodePort is randomly choosen between 30000-32767 , then use kubectl edit to modify the port of the service to nodePort: 30080
kubectl expose deploy nginx --type=NodePort --port=80
kubectl edit svc nginx
show
kubectl run redis --generator=run-pod/v1 --image=redis:alpine -l tier=db
Create a Service named redis-service of type ClusterIP to expose pod redis on port 6379 with the label tier=db
show
kubectl expose pod redis --name redis-service --port=6379 -l tier=db
show
using something like:
db-service.dev.src.cluster.local