Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenFunction 1.2.0 imageCredentials pull private images fail #501

Open
xuybin opened this issue Sep 27, 2023 · 2 comments
Open

OpenFunction 1.2.0 imageCredentials pull private images fail #501

xuybin opened this issue Sep 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@xuybin
Copy link

xuybin commented Sep 27, 2023

Description
imageCredentials pull private images fail.

Environmental
Tell us what your cluster environment is like, e.g.

  • Operating System Information
  • kubernetes v1.27.3
  • OpenFunction 1.2.0
  • Versions of dependent components (e.g. dapr, keda, shipwright, knative)

Expected behavior
use imageCredentials pull private images ok

Actual behavior
Tell us what happens instead. Provide a log message if relevant.

To Reproduce
Steps to reproduce the behavior:

apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
  name: sample-node-keda
  namespace: keda # must be in the same namespace with keda http-addon
spec:
  version: "v2.0.0"
  #image: "stefanprodan/podinfo:latest" #使用此配置,正常启动函数
  image: "xuybin/podinfo:latest" #在hub.docker.com设置为公开时,正常启动
  imageCredentials: #设置成私有,加此配置,报拉取失败
    name: push-secret-docker #反复确认密钥正确,使用它成功打包了函数并上传到同名仓库
  serving:
    triggers:
      http:
        engine: "keda" # optional, default to knative if not set
        port: 9898
        route:
          gatewayRef:
            name: openfunction
            namespace: openfunction
          # hostnames:
          #   - "podinfo.com"
          rules:
            - matches:
                - path:
                    type: PathPrefix
                    value: /
    scaleOptions:
      minReplicas: 1
      maxReplicas: 10
      keda:
        httpScaledObject:
          targetPendingRequests: 100 # Default 100
          cooldownPeriod: 60 # Default 300
    template:
      containers:
        - name: function # DO NOT change this
          imagePullPolicy: IfNotPresent

. See error

Screenshots
If applicable, add screenshots to help explain your problem.
image
image
image

Additional context
Add any other context about the problem here.

@xuybin xuybin added the bug Something isn't working label Sep 27, 2023
@xuybin xuybin changed the title imageCredentials pull private images fail OpenFunction 1.2.0 imageCredentials pull private images fail Sep 27, 2023
@aryasoni98
Copy link

@xuybin I would like to work on it .

@aryasoni98
Copy link

@xuybin

The issue you're experiencing is related to Kubernetes not being able to pull a private image from Docker Hub, as indicated by the error messages related to imagePullBackOff and ErrImagePull.

The likely causes are:

  1. The secret push-secret-docker is not correctly configured with the right Docker credentials.
  2. The image name xuybin/podinfo:latest does not exist or is misspelled in Docker Hub.
  3. The Docker Hub repository xuybin/podinfo is not set to public, and Kubernetes is unable to authenticate with the provided credentials.

To resolve this:

  • Ensure that the Docker Hub repository exists and the image tag is correct.
  • Verify that the push-secret-docker Kubernetes secret contains the correct Docker credentials (username and password/token).
  • If the repository is private, make sure the secret is created with the dockerconfigjson type and the correct .dockerconfigjson content.
  • Apply the secret to the same namespace where your Kubernetes service is running.

If you have confirmed the above and the issue persists, you may want to manually pull the image on a local machine using the same credentials to ensure they are working. If they are, then reapply the secret and try to pull the image again on your cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants