https://pulumi.com logo
#general
Title
# general
b

broad-kilobyte-43768

09/18/2021, 8:55 PM
hi y'all, has anyone had trouble getting stack references working in GitHub Actions? When I run
pulumi up
locally it works, but it fails with this error whenever the provider is used on my GitHub action.
THING creating error: configured Kubernetes cluster is unreachable: unable to load Kubernetes client configuration from kubeconfig file: invalid configuration: no configuration has been provided
This is my infra code on a repo called "api"
Copy code
const sharedInfrastructure = new pulumi.StackReference(sharedInfraStackName)
const provider = new k8s.Provider('k8s', {
  kubeconfig: sharedInfrastructure.getOutput('kubeConfig'),
})
// use provider...
Action
Copy code
name: Infrastructure push
on:
  push:
    branches:
      - main
    paths:
      - 'infrastructure/**'

jobs:
  apply:
    name: Apply infrastructure
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 14.x
      - run: cd infrastructure && npm install
      - uses: pulumi/actions@v3
        with:
          command: up
          stack-name: dev
          work-dir: ./infrastructure
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
          DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
Here's how I create my kubernetes cluster in another shared infra repo:
Copy code
import * as digitalocean from '@pulumi/digitalocean'
import * as k8s from '@pulumi/kubernetes'

const cluster = new digitalocean.KubernetesCluster('cluster', {
  region: digitalocean.Region.LON1,
  version: 'latest',
  nodePool: {
    name: 'default',
    size: digitalocean.DropletSlug.DropletS2VCPU2GB,
    nodeCount: 1,
  },
})

export const kubeConfig = cluster.kubeConfigs[0].rawConfig
Does anyone have any tips to solve this?
b

billowy-army-68599

09/19/2021, 11:24 PM
hey @broad-kilobyte-43768 - does your
KUBECONFIG
generated use any specific credentials? did you get this working?
b

broad-kilobyte-43768

09/20/2021, 12:24 AM
My workaround was to move all my infrastructure code into one repo. It was too much hassle dealing with undefined values from the external references.
46 Views