【问题标题】:How to install Selenium Grid 4 in Kubernetes?如何在 Kubernetes 中安装 Selenium Grid 4?
【发布时间】:2021-07-06 04:59:07
【问题描述】:

我想在 Kubernetes 中安装 Selenium Grid 4。我是新来的。任何人都可以分享舵图或清单或安装步骤或任何东西。我找不到任何东西。

谢谢。

【问题讨论】:

  • 嗨@WytrzymałyWiktor 不是真的。我期待着完成清单。我不能将以下清单称为生产级。

标签: kubernetes kubernetes-helm selenium-grid


【解决方案1】:

您可以在以下位置找到 selenium docker hub 映像:https://hub.docker.com/layers/selenium/hub/4.0.0-alpha-6-20200730

YAML 示例

apiVersion: apps/v1
kind: Deployment
metadata:
  name: selenium-hub
spec:
  selector:
    matchLabels:
      app: selenium-hub
  strategy:
    type: RollingUpdate
    rollingUpdate:
     maxSurge: 1
     maxUnavailable: 0
  template:
    metadata:
      labels:
        app: selenium-hub
    spec:
      containers:
      - name: selenium-hub
        image: selenium/hub:3.141.59-20200515
        resources:
          limits:
            memory: "1000Mi"
            cpu: "500m"
        ports:
          - containerPort: 4444
        livenessProbe:
            httpGet:
              path: /wd/hub/status
              port: 4444
            initialDelaySeconds: 30
            timeoutSeconds: 5

您可以阅读更多内容:https://www.swtestacademy.com/selenium-kubernetes-scalable-parallel-tests/

【讨论】:

    【解决方案2】:

    我找到了一个tutorial 用于在 Kubernetes 集群中设置 Selenium 网格。在这里您可以找到示例:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: selenium-hub
    spec:
      selector:
        matchLabels:
          app: selenium-hub
      strategy: 
        type: RollingUpdate
        rollingUpdate:
          maxSurge: 1
          maxUnavailable: 0      
      template:
        metadata:
          labels:
            app: selenium-hub
        spec:
          containers:
          - name: selenium-hub
            image: selenium/hub:4.0.0
            resources:
              limits:
                memory: "128Mi"
                cpu: "500m"
            ports:
              - containerPort: 4444
            livenessProbe:
                httpGet:
                  path: /wd/hub/status
                  port: 4444
                initialDelaySeconds: 30
                timeoutSeconds: 5
    
    apiVersion: v1
    kind: Pod
    metadata:
      name: selenium-hub
      labels:
        name: hub
    spec:
      containers:
      - name: selenium-hub
        image: selenium/hub:3.141.59-20200326
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
          - containerPort: 4444
        livenessProbe:
            httpGet:
              path: /wd/hub/status
              port: 4444
            initialDelaySeconds: 30
            timeoutSeconds: 5
    
    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: selenium-rep
    spec:
      replicas: 2
      selector:
        app: selenium-chrome
      template:
        metadata:
          name: selenium-chrome
          labels:
            app: selenium-chrome
        spec:
          containers:
            - name: node-chrome
              image: selenium/node-chrome
              ports:
                - containerPort: 5555
              env:
                - name: HUB_HOST
                  value: "selenium-srv"
                - name: HUB_PORT
                  value: "4444"
    
    apiVersion: v1
    kind: Service
    metadata:
      name: selenium-srv
      labels:
        app: selenium-srv
    spec:
      selector:
        app: selenium-hub
      ports:
      - port: 4444
        nodePort: 30001
      type: NodePort
    

    本教程也记录在YouTube。您可以在playlist 上找到与 Kubernetes 上的 Selenium Grid 相关的几集。

    【讨论】:

      【解决方案3】:

      回答可能会迟到,但现在我们有了带有 helm 图表的 selemium-hub。只是发布链接以防有人偶然发现同样的问题。感谢您的贡献。

      Selenium-hub helm chart

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-07-30
        • 2022-11-26
        • 1970-01-01
        • 1970-01-01
        • 2023-01-18
        • 1970-01-01
        • 2022-08-17
        相关资源
        最近更新 更多