sparse-intern-71089
04/22/2022, 3:44 AMlittle-cartoon-10569
04/22/2022, 3:54 AMbright-horse-50102
04/22/2022, 4:00 AMbright-horse-50102
04/22/2022, 4:01 AMbright-horse-50102
04/22/2022, 4:02 AMbright-horse-50102
04/22/2022, 4:12 AMType Name Status Info
pulumi:pulumi:Stack _redacted_ **failed** 1 error
+ └─ kubernetes:core/v1:Service nginx-service **creating failed** 1 error
Diagnostics:
kubernetes:core/v1:Service (nginx-service):
error: 2 errors occurred:
* resource default/nginx-service-nm3byu6a was successfully created, but the Kubernetes API server reported that it failed to fully initialize or become live: 'nginx-service-nm3byu6a' timed out waiting to be Ready
* Service does not target any Pods. Selected Pods may not be ready, or field '.spec.selector' may not match labels on any Pods
pulumi:pulumi:Stack (_redacted_):
error: update failed
Is this the documentation being wrong or Pulumi being wrong?little-cartoon-10569
04/22/2022, 4:18 AMlabels
? You're specifying it as an object, but the examples all have it as an array of strings....bright-horse-50102
04/22/2022, 4:23 AMlabels
isn't a thing anymorebright-horse-50102
04/22/2022, 4:24 AMlittle-cartoon-10569
04/22/2022, 4:24 AMbright-horse-50102
04/22/2022, 4:25 AMkubectl get statefulset
returns an empty list). I also don't see a creating...
in the pulumi cli output for the statefulset; it starts by trying to create the service first, it'll say the service is waiting for n
pods matching the selector, and this times out because those pods never get spawned (because the statefulset isn't being made)bright-horse-50102
04/22/2022, 4:25 AMlittle-cartoon-10569
04/22/2022, 4:27 AMbright-horse-50102
04/22/2022, 4:27 AMbillowy-army-68599
bright-horse-50102
04/22/2022, 8:13 AMbillowy-army-68599
spec: {
selector: {
matchLabels: {
app: "nginx",
},
},
The reason you're having a hard time using serviceName: 'app-svc',
is because pulumi has logic in it to ensure the service has healthy pods behind it. by setting the name this way, you're creating a circular dependency. remove the serviceName
property and use the matchlabels property insteadbright-horse-50102
04/22/2022, 8:20 AMserviceName
anyway (right below the selector). It's included in the example. Am I missing something? 😅billowy-army-68599
billowy-army-68599
bright-horse-50102
04/22/2022, 8:22 AM<http://k8s.gcr.io/nginx-slim:0.8|k8s.gcr.io/nginx-slim:0.8>
image. Copied the entire codeblock and didn't change anything elsebillowy-army-68599
bright-horse-50102
04/22/2022, 8:24 AMnginxService
to nginx-service
on line 4 because I was getting an error about service names having to be valid DNS names (i.e. lowercase). No changes other than thatbright-horse-50102
04/22/2022, 8:25 AMbright-horse-50102
04/22/2022, 8:25 AMimport * as kubernetes from '@pulumi/kubernetes';
const nginxService = new kubernetes.core.v1.Service('nginx-service', {
metadata: {
labels: {
app: 'nginx',
},
},
spec: {
ports: [ {
port: 80,
name: 'web',
} ],
clusterIP: 'None',
selector: {
app: 'nginx',
},
},
});
const wwwStatefulSet = new kubernetes.apps.v1.StatefulSet('wwwStatefulSet', {
spec: {
selector: {
matchLabels: {
app: 'nginx',
},
},
serviceName: nginxService.metadata.name,
replicas: 3,
template: {
metadata: {
labels: {
app: 'nginx',
},
},
spec: {
terminationGracePeriodSeconds: 10,
containers: [ {
name: 'nginx',
image: '<http://k8s.gcr.io/nginx-slim:0.8|k8s.gcr.io/nginx-slim:0.8>',
ports: [ {
containerPort: 80,
name: 'web',
} ],
volumeMounts: [ {
name: 'www',
mountPath: '/usr/share/nginx/html',
} ],
} ],
},
},
volumeClaimTemplates: [ {
metadata: {
name: 'www',
},
spec: {
accessModes: [ 'ReadWriteOnce' ],
storageClassName: 'my-storage-class',
resources: {
requests: {
storage: '1Gi',
},
},
},
} ],
},
});
billowy-army-68599
bright-horse-50102
04/22/2022, 8:44 AMbillowy-army-68599
bright-horse-50102
04/22/2022, 8:46 AMbillowy-army-68599
bright-horse-50102
04/22/2022, 8:49 AMbillowy-army-68599
bright-horse-50102
04/22/2022, 8:51 AMbillowy-army-68599