PodCoreV1 class
Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.
This resource waits until its status is ready before registering success for create/update, and populating output properties from the current state of the resource. The following conditions are used to determine whether the resource creation has succeeded or failed:
- The Pod is scheduled ("PodScheduled"" '.status.condition' is true).
- The Pod is initialized ("Initialized" '.status.condition' is true).
- The Pod is ready ("Ready" '.status.condition' is true) and the '.status.phase' is set to "Running". Or (for Jobs): The Pod succeeded ('.status.phase' set to "Succeeded").
If the Pod has not reached a Ready state after 10 minutes, it will time out and mark the resource update as Failed. You can override the default timeout value by setting the 'customTimeouts' option on the resource.
{{% examples %}}
Example Usage
{{% example %}}
Create a Pod with auto-naming
import * as pulumi from "@pulumi/pulumi";
import * as kubernetes from "@pulumi/kubernetes";
const pod = new kubernetes.core.v1.Pod("pod", {spec: {
containers: [{
image: "nginx:1.14.2",
name: "nginx",
ports: [{
containerPort: 80,
}],
}],
}});
import pulumi
import pulumi_kubernetes as kubernetes
pod = kubernetes.core.v1.Pod("pod", spec=kubernetes.core.v1.PodSpecArgs(
containers=[kubernetes.core.v1.ContainerArgs(
image="nginx:1.14.2",
name="nginx",
ports=[kubernetes.core.v1.ContainerPortArgs(
container_port=80,
)],
)],
))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Kubernetes = Pulumi.Kubernetes;
return await Deployment.RunAsync(() =>
{
var pod = new Kubernetes.Core.V1.Pod("pod", new()
{
Spec = new Kubernetes.Types.Inputs.Core.V1.PodSpecArgs
{
Containers = new[]
{
new Kubernetes.Types.Inputs.Core.V1.ContainerArgs
{
Image = "nginx:1.14.2",
Name = "nginx",
Ports = new[]
{
new Kubernetes.Types.Inputs.Core.V1.ContainerPortArgs
{
ContainerPortValue = 80,
},
},
},
},
},
});
});
package main
import (
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := corev1.NewPod(ctx, "pod", &corev1.PodArgs{
Spec: &corev1.PodSpecArgs{
Containers: corev1.ContainerArray{
&corev1.ContainerArgs{
Image: pulumi.String("nginx:1.14.2"),
Name: pulumi.String("nginx"),
Ports: corev1.ContainerPortArray{
&corev1.ContainerPortArgs{
ContainerPort: pulumi.Int(80),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kubernetes.core_v1.Pod;
import com.pulumi.kubernetes.core_v1.PodArgs;
import com.pulumi.kubernetes.core_v1.inputs.PodSpecArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var pod = new Pod("pod", PodArgs.builder()
.spec(PodSpecArgs.builder()
.containers(ContainerArgs.builder()
.image("nginx:1.14.2")
.name("nginx")
.ports(ContainerPortArgs.builder()
.containerPort(80)
.build())
.build())
.build())
.build());
}
}
description: Create a Pod with auto-naming
name: yaml-example
resources:
pod:
properties:
spec:
containers:
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 80
type: kubernetes:core/v1:Pod
runtime: yaml
pulumi {
required_providers {
kubernetes = {
source = "pulumi/kubernetes"
}
}
}
resource "kubernetes_core_v1_pod" "pod" {
spec = {
containers = [{
image = "nginx:1.14.2"
name = "nginx"
ports = [{
container_port = 80
}]
}]
}
}
{{% /example %}} {{% example %}}
Create a Pod with a user-specified name
import * as pulumi from "@pulumi/pulumi";
import * as kubernetes from "@pulumi/kubernetes";
const pod = new kubernetes.core.v1.Pod("pod", {
metadata: {
name: "nginx",
},
spec: {
containers: [{
image: "nginx:1.14.2",
name: "nginx",
ports: [{
containerPort: 80,
}],
}],
},
});
import pulumi
import pulumi_kubernetes as kubernetes
pod = kubernetes.core.v1.Pod("pod",
metadata=kubernetes.meta.v1.ObjectMetaArgs(
name="nginx",
),
spec=kubernetes.core.v1.PodSpecArgs(
containers=[kubernetes.core.v1.ContainerArgs(
image="nginx:1.14.2",
name="nginx",
ports=[kubernetes.core.v1.ContainerPortArgs(
container_port=80,
)],
)],
))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Kubernetes = Pulumi.Kubernetes;
return await Deployment.RunAsync(() =>
{
var pod = new Kubernetes.Core.V1.Pod("pod", new()
{
Metadata = new Kubernetes.Types.Inputs.Meta.V1.ObjectMetaArgs
{
Name = "nginx",
},
Spec = new Kubernetes.Types.Inputs.Core.V1.PodSpecArgs
{
Containers = new[]
{
new Kubernetes.Types.Inputs.Core.V1.ContainerArgs
{
Image = "nginx:1.14.2",
Name = "nginx",
Ports = new[]
{
new Kubernetes.Types.Inputs.Core.V1.ContainerPortArgs
{
ContainerPortValue = 80,
},
},
},
},
},
});
});
package main
import (
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := corev1.NewPod(ctx, "pod", &corev1.PodArgs{
Metadata: &metav1.ObjectMetaArgs{
Name: pulumi.String("nginx"),
},
Spec: &corev1.PodSpecArgs{
Containers: corev1.ContainerArray{
&corev1.ContainerArgs{
Image: pulumi.String("nginx:1.14.2"),
Name: pulumi.String("nginx"),
Ports: corev1.ContainerPortArray{
&corev1.ContainerPortArgs{
ContainerPort: pulumi.Int(80),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kubernetes.core_v1.Pod;
import com.pulumi.kubernetes.core_v1.PodArgs;
import com.pulumi.kubernetes.meta_v1.inputs.ObjectMetaArgs;
import com.pulumi.kubernetes.core_v1.inputs.PodSpecArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var pod = new Pod("pod", PodArgs.builder()
.metadata(ObjectMetaArgs.builder()
.name("nginx")
.build())
.spec(PodSpecArgs.builder()
.containers(ContainerArgs.builder()
.image("nginx:1.14.2")
.name("nginx")
.ports(ContainerPortArgs.builder()
.containerPort(80)
.build())
.build())
.build())
.build());
}
}
description: Create a Pod with a user-specified name
name: yaml-example
resources:
pod:
properties:
metadata:
name: nginx
spec:
containers:
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 80
type: kubernetes:core/v1:Pod
runtime: yaml
pulumi {
required_providers {
kubernetes = {
source = "pulumi/kubernetes"
}
}
}
resource "kubernetes_core_v1_pod" "pod" {
metadata = {
name = "nginx"
}
spec = {
containers = [{
image = "nginx:1.14.2"
name = "nginx"
ports = [{
container_port = 80
}]
}]
}
}
{{% /example %}} {{% /examples %}}
Constructors
Properties
-
apiVersion
↔ Output<
String> -
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
kind
↔ Output<
String> -
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
latefinal
-
metadata
↔ Output<
ObjectMeta> -
Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
spec
↔ Output<
PodSpec> -
Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
latefinal
-
status
↔ Output<
PodStatus?> -
Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited