k8s cluster-info --context kind-k8sjerry
Kubernetes control plane is running at https://127.0.0.1:60899 CoreDNS is running at https://127.0.0.1:60899/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
k8s config set-context kind-k8sjerry
k8s apply -f ngix-deploy.yaml
kubectl scale deploy/nginx-deployment --replicas=2
kubectl run redis --image='redis:alpine'
k8s get rs -o wide
k8s describe deployment nginx-deployment
k8s rollout [undo|status|] deployment/ngix-deployment
k8s expose deploy/nginx-deployment --port=8080 --protocol=TCP --target-port=80 --name nginx-svc
k8s expose deploy/nginx-deployment --port=8080 --protocol=TCP --target-port=80 --name nginx-svc-nodeport --type=NodePort
k8s port-forward svc/nginx-svc 8080:8080
k8s port-forward pod/nginx-deployment-7d857f4d64-9skfd 8081:80
k8s proxy
k8s get roles k8s get rolebindings --all-namespaces k8s get clusterroles kubectl get clusterrolebindings
openssl genrsa -out backend.key 2048
openssl req -new -key backend.key -out backend.csr -subj "/CN=backend/O=dev"
openssl x509 -req -in backend.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out backend.crt -days 365
openssl x509 -in backend.crt -text -noout
kubectl config get-clusters kubectl config get-contexts kubectl config get-users kubectl config use-context kubectl config set-context
kubectl config use-context kubernetes-admin@k8sjerry kubectl config use-context backend-context
kubectl config set-credentials backend --client-certificate=/root/backend.crt --client-key=/root/backend.key
kubectl config set-context backend-context --cluster=k8sjerry --namespace=k8s-test --user=backend
kubectl config set-context backend-context-2 --cluster=k8sjerry --user=backend
过程: docker-compose -> k8s -> helm
export NODE_PORT=$(kubectl get --namespace work -o jsonpath="{.spec.ports[0].nodePort}" services saythx-frontend) export NODE_IP=$(kubectl get nodes --namespace work -o jsonpath="{.items[0].status.addresses[0].address}")
k8s describe
k8s get events
kubectl apply -f https://gitee.com/K8S-release/k8s-dashboard/raw/master/kubernetes-dashboard.yaml
或者
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml