https://pulumi.com logo
#typescript
Title
# typescript
t

thankful-optician-22583

08/02/2019, 9:15 PM
Hi guys I have a simple question regarding pulumi for kubernetes. my application folder contains a dockerfile. I am able to build an image and push to ecr using "@pulumi/docker". My challenge comes when I use "@pulumi/kubernetes", and I want to access that image that I put in ECR. How do i make sure that the Deployment can access the image? I am not sure if it is trying to access DockerHub vs ECR.
h

handsome-actor-1155

08/02/2019, 9:46 PM
In one function I return the image:
Copy code
return new docker.Image("correctiveActionProducer", {
        imageName: ecr.repositoryUrl,
        build: "./",
        registry: ecrCreds
    });
Then I pass that image to my deployment:
Copy code
export function createProducer(
    anomalyTopic: Output<any>,
    correctionTopic: Output<any>,
    provider: k8s.Provider,
    image: Image): void {
    const applicationName = config.require("applicationName");
    new k8s.apps.v1.Deployment(applicationName, {
        apiVersion: "apps/v1",
        kind: "Deployment",
        metadata: {
            name: applicationName
        },
        spec: {
            replicas: 1,
            selector: {
                matchLabels: {"asset": "stream", "app": applicationName}
            },
            template: {
                metadata: {
                    labels: {"asset": "stream", "app": applicationName}
                },
                spec: {
                    containers: [{
                        name: applicationName,
                        image: image.imageName,
                        ...
Copy code
const appImage = app.createAndUploadImage();
app.createProducer(
    serviceStack.getOutput("anomalyTopic"),
    serviceStack.getOutput("correctiveActionTopic"),
    k8sApplicationProvider,
    appImage
);