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-08-24
  • 2022-12-23
  • 2021-04-25
  • 2021-05-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2021-06-17
  • 2021-07-20
  • 2021-12-01
相关资源
相似解决方案