systemctl restart kube-apiserver

kubectl delete pod ${pod.name}

kubectl delete {name}

kubectl delete services ${service.name}

kubectl get deployments

kubectl get pods

kubectl get rc

kubectl get events

kubectl config view

kubectl get services

kubectl get namespaces

kubectl get nodes

# 查看ip和端口,也叫端点
kubectl get ep 

kubectl get replicationcontrollers

kubectl describe node nodename

kubectl describe pods nacos



kubectl create -f mynode-rc.yaml
kubectl delete -f mynode-rc.yaml

kubectl delete -f nginx.yaml -f redis.yaml

kubectl replace -f nginx.yaml

kubectl get pods -o wide

kubectl get deploy

kubectl get all -o wide

#动态缩放
kubectl scale rc myapp --replicas=3

# 创建Service
# Pod可以通过CLUSTER-IP+端口号,进行访问

kubectl create -f mysql-svc.yaml

kubectl get svc


# mysql-svc.yaml
# 外网通过 docker主机IP+30306端口访问
apiVersion: v1
kind: Service
metadata:
  name: mysql
spec:
  type: NodePort
  ports:
    - port: 3306
      nodePort: 30306
  selector:
    app: mysql

删除svc

kubectl delete -f ${name}.yaml

# 比如svc的name=nginx1
kubectl delete svc/nginx1

删除deployment

kubectl delete deployment/my-tomcat

删除node

# 查看节点
kubectl get node

# 删除节点
kubectl  delete nodes $nodename

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐