examples
examples copied to clipboard
Deploying custom apps
Hello!
- Vote on this issue by adding a 👍 reaction
- To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)
Issue details
I'm trying to deploy a hello world container in kubernetes using Pulumi and GCP
Basically I just want this local helloworld container to be deployed in an existing k8s cluster on GCP made following this tutorial.
Deploying local images is what is done in this other example, however I need to add registry information which causes an error: Property 'repositoryUrl' does not exist on type 'Promise<GetRegistryRepositoryResult>'.
const registry = gcp.container.getRegistryRepository();
// Build a Docker image from a local Dockerfile context in the
// './mydockerimg' directory, and push it to the registry.
//const registry = gcp.container.getRegistryRepository();
const customImage = "mydockerimg";
const appImage = new docker.Image(customImage, {
// imageName: pulumi.interpolate`${registry.repositoryUrl}/${customImage}:v1.0.0`,
imageName: "mydockerimg",
build: {
context: `./${customImage}`,
},
});
// Create a k8s provider.
// NOT NEEDED
// Create a Deployment of the built container.
const appLabels_helloworld = { app: customImage };
const appDeployment = new k8s.apps.v1.Deployment("app", {
spec: {
selector: { matchLabels: appLabels_helloworld },
replicas: 1,
template: {
metadata: { labels: appLabels_helloworld },
spec: {
containers: [{
name: customImage,
image: appImage.imageName,
ports: [{name: "http", containerPort: 80}],
}],
}
},
}
}, { provider: clusterProvider });
When I just use imageName: "mydockerimg", rather than a registry, pulumi accepts the upgrade, but then I have a docker push error:
error: Error: ' docker push mydockerimg:4aff09801cccc271a8182a3eb3bc46a25764fdbb5332230c6aa707e3b90c4d4e' failed with exit code 1
The push refers to repository [docker.io/library/mydockerimg]
Any help?
Steps to reproduce
Take the first tutorial, and try to add the deployment of the local image from the second tutorial.
Expected: container running on k8s Actual: error upgrading
You need to include the registry property on the Image resource in order to provide the appropriate server information and credentials in order to push your image (see https://www.pulumi.com/docs/reference/pkg/docker/image/#create-and-push-image-to-azure-container-registry for an example)
@gpierard Did this help address your issue?