Python Docker 接口测试代码-立哥开发

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license()” for more information.


#Copy right by Jacky Zong .
apiVersion: v1.8
kind: Service # 类型包含Pod, Deployment、Job、Ingress、Service
metadata: # 包含应用的一些meta信息,比如名称、namespace、标签等信息。
name: test-service # 名称还能为小写和-
namespace: test
labels:
app: test-service
spec:
type: NodePort # NodePort类型每个 node 上都会监听同一个端口,会自动找到pod所在的节点,LoadBalancer会为这个服务提供一个对外ip,ip代理下面的pod。pod可能在不同的机器上
ports:

  • port: 1000
    targetPort: 1000 # container端口
    protocol: TCP
    name: http
    selector:
    app: test-pod

apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment
namespace: test
spec: # 包括一些container,storage,volume以及其他Kubernetes需要的参数,以及诸如是否在容器失败时重新启动容器的属性。可在特定Kubernetes API找到完整的Kubernetes Pod的属性。
selector:
matchLabels:
app: test-pod
replicas:2 # 选项定义需要的副本个数,此处可以设置很多属性,例如受此Deployment影响的Pod的选择器等
template: # template其实就是对Pod对象的定义
metadata:
labels:
app: test-pod
spec:
volumes:
imagePullSecrets:
- name: hubsecret
containers:
- name: test-container # 容器名称
image: mldp/cloud:safety-1.0.7 # 基于的镜像名, 根据镜像创建容器
command: [‘sleep’,‘500’]
ports: # 容器将会监听的指定端口号
- containerPort: 1000

猜你喜欢

转载自blog.csdn.net/weixin_45806384/article/details/107225525