development service pod relations
kubectl commonly used commands
kubectl cluster-info # View cluster information
kubectl describe pod -n kube-system kube-flannel-ds-amd64-trpqq # pod See the description of
kubectl get pods -n kube-system # View the specified namespace pod
kubectl create deployment NAME --image = image [--dry-run] [options] # Create a deployment, dry-run for the true test is not performed
kubectl expose deployment nginx-deploy --name=nginx --port=80 --target-port=80 --protocol=TCP
# Create a service for the deployment, --name name for the service, --port port is exposed, --target-port target pod port
Are dig -t A nginx.default.svc.cluster.local @ 10.96.0.10 # verification service can parse correctly, @ back to k8s ip address of the dns
kubectl describe svc nginx # description of service
kubectl get pods --show-labels # View pod label
kubectl scale deployment nginx-deploy --replicas = 3 # capacity expansion or contraction, --replicas the number
wget -O - -q nginx-deploy
kubectl rollout undo deployment myapp-deploy --to-revision = 1 # roll back to the version specified, the default rollback to the previous version
kubectl explain pod
Inventory Configuration
apiVersion: v1
kind: Pod
metadata:
name: pod-demo
namespace: default
labels:
app: myapp
tier: frontend
spec:
containers:
- name: myapp
image: ikubernetes/myapp:v1
- name: busybox
image: busybox
command:
- "/bin/sh"
- "-c"
- "sleep 5"
kubectl create -f test.yaml
kubectl delete -f test.yaml
kubectl describe pod pod-demo
kubectl describe pod pod-demo
kubectl exec -it pod-demo -c myapp -- /bin/sh
https://blog.csdn.net/ucsheep/article/details/81781509