vim k8s-tomcat7.yaml

apiVersion: apps/v1beta2 #当前配置格式版本 kind: Deployment #创建资源类型 metadata: #资源元数据,name是必须项 name: tomcat7-deployment namespace: kube-system spec: #资源规格说明 replicas:
1 #副本数量 selector: matchLabels: k8s-app: web-tomcat7 template: #定义pod模板 metadata: #pod元数据,至少一个label labels: k8s-app: web-tomcat7 spec: #pod规格说明 containers: - name: tomcat7 image: java8tomcat7:1.0 ports: - containerPort: 8080 --- apiVersion: v1 kind: Service metadata: name: web-tomcat7 namespace: kube-system spec: ports: - port: 8099 targetPort: 8080 nodePort: 30899 #浏览器访问的端口 selector: k8s-app: web-tomcat7 type: NodePort

运行:kubectl apply -f k8s-tomcat7.yaml 

删除:kubectl delete -f k8s-tomcat7.yaml 

查看所有节点:kubectl get pods --all-namespaces -o wide

查看某个节点的情况:kubectl description tomcat7-deployment-87f87c9ff-mks5t get pods

 

相关文章:

  • 2021-11-18
  • 2021-12-10
  • 2021-08-16
  • 2021-10-06
  • 2021-08-22
  • 2021-08-30
  • 2021-11-21
  • 2021-10-11
猜你喜欢
  • 2021-11-23
  • 2021-11-02
  • 2021-11-24
  • 2019-12-11
  • 2019-07-01
  • 2019-09-22
  • 2021-08-16
  • 2021-10-13
相关资源
相似解决方案