0

I have a Kubernetes deployment yaml, which successfully pulls an image from a private Docker registry with authentication.
I'd like to do the same using Radius, but it's not clear how to do this using generic Kubernetes (not Azure).
Kubernetes is configuged with the secret 'docker-registry-secret' in both the default namespace and the namespace Radius is using 'default-my-api'.

The yaml uses imagePullSecrets; what is the Radius equivalent?

The K8s deployment yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-api
spec:
  selector:
    matchLabels:
      app: my-api
  template:
    metadata:
      labels:
        app: my-api
    spec:
      containers:
        - name: my-api
          image: reg.my-registry.com:5000/my-api-app:latest
      imagePullSecrets:
          - name: docker-registry-secret

The Radius bicep:

import radius as radius

@description('The Radius Application ID. Injected automatically by the rad CLI.')
param application string

resource snapapi 'Applications.Core/containers@2023-10-01-preview' = {
  name: 'my-api'
  properties: {
    application: application
    container: {
      image: 'reg.my-registry.com:5000/my-api-app:latest'
    }
  }
}

I see the error "Failed to pull image ... no basic auth credentials"

I can find examples using Azure Container Registry, but not a lot for a private Docker image registry, deploying to a local, generic Kubernetes cluster.

imagePullSecrets doesn't seem to be a supported mechanism in bicep. How is it configured?

3
  • If you are trying to deploy a container to Kubernetes using Radius and need to pull the container image from a private Docker registry (not hosted on Azure Container Registry), you'll need to address the absence of direct support for imagePullSecrets in Radius's Bicep configuration. Radius primarily caters to Azure-centric deployments and its native Bicep templates may not directly support Kubernetes features like imagePullSecrets. Commented Apr 30, 2024 at 12:27
  • 1
    I have found a solution to this problem, but for some reason the question has been closed. Can it be reopened? Commented May 3, 2024 at 9:57
  • Please post your solution as answer for ease of community members so that they can refer to your solution if they face similar issue. Thanks Commented May 3, 2024 at 10:48

1 Answer 1

0

In the bicep file, use the following:

properties: {
  runtimes: {
    kubernetes: {
      base: loadTextContent('deployment.yaml')
    }
  }
}

This will use a base Kubernetes resource manifest on top of which Radius specified properties will be applied. The base resource will contain the imagePullSecrets. For further info, see the docs: Radius docs - Container service - properties/runtimes/kubernetes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.