Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devspace with k3d integration in WSL2 #2872

Open
lee-aaron opened this issue Jul 21, 2024 · 2 comments
Open

devspace with k3d integration in WSL2 #2872

lee-aaron opened this issue Jul 21, 2024 · 2 comments
Labels
kind/bug Something isn't working

Comments

@lee-aaron
Copy link

lee-aaron commented Jul 21, 2024

What happened?
I'm trying to run k3d with devspace but am seeing unauthorized when pushing to the repository.

❯ make build services="payment"
info Using namespace 'takara'
info Using kube context 'k3d-takara-dev'
payment make[1]: Entering directory '/home/aaron/Takara/takara-backend/payment'
payment go build -o ./bin/payment ./cmd/payment
payment make[1]: Leaving directory '/home/aaron/Takara/takara-backend/payment'
payment build:payment Rebuild image registry.localhost:5000/lee-aaron/go-payment because image config has changed
payment build:payment Building image 'registry.localhost:5000/lee-aaron/go-payment:WYEleJx' with engine 'docker'
payment build:payment Authenticating (registry.localhost:5000)...
payment build_images: build images: error building image registry.localhost:5000/lee-aaron/go-payment:WYEleJx: Error during image registry authentication: Error response from daemon: login attempt to http://registry.localhost:5000/v2/ failed with status: 403 Forbidden
fatal exit status 1
make: *** [Makefile:9: build] Error 1

What did you expect to happen instead?
It should build and deploy the pod fine

How can we reproduce the bug? (as minimally and precisely as possible)

k3d.yaml

apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
  name: takara-dev
servers: 1
agents: 2

kubeAPI:
  hostIP: "127.0.0.1"
  hostPort: "6445"
token: superSecretToken # same as `--token superSecretToken`

registries: # define how registries should be created or used
  create: # creates a default registry to be used with the cluster; same as `--registry-create registry.localhost`
    name: registry.localhost
    host: "0.0.0.0"
    hostPort: "5000"
  mirrors:
  "registry.localhost:5000":
    endpoint:
    - http://registry.localhost:5000
options:
  k3d: # k3d runtime settings
    wait: true # wait for cluster to be usable before returining; same as `--wait` (default: true)
    timeout: "60s" # wait timeout before aborting; same as `--timeout 60s`
    disableLoadbalancer: false # same as `--no-lb`
    disableImageVolume: false # same as `--no-image-volume`
    disableRollback: false # same as `--no-Rollback`
  kubeconfig:
    updateDefaultKubeconfig: true # add new cluster to your default Kubeconfig; same as `--kubeconfig-update-default` (default: true)
    switchCurrentContext: true # also set current-context to the new cluster's context; same as `--kubeconfig-switch-context` (default: true)

Add to /etc/hosts

127.0.0.1 registry.localhost
::1 registry.localhost

My devspace.yaml:

version: v2beta1
name: takara-dev

imports:
- path: ../devspace-vars.yaml

images:
  payment:
    image: registry.localhost:5000/lee-aaron/go-payment
    dockerfile: Dockerfile.prod
    context: .
    docker:
      args:
      - "--platform=linux/amd64"

pipelines:
  dev:
    run: |
      start_dev payment

  build:
    run: |
      make build-go
      build_images payment
      echo "payment built"

deployments:
  payment:
    helm:
      chart:
        name: component-chart
        repo: https://charts.devspace.sh
      values:
        containers:
        - image: ${runtime.images.payment.image}:${runtime.images.payment.tag}
          env:
          - name: ENV
            value: development
          - name: PORT
            value: "3008"

Commands I used

k3d cluster create -c ./k3d.yaml
devspace build -b -a "payment"

Local Environment:

  • DevSpace Version: 6.3.12
  • Operating System: windows wsl2
  • ARCH of the OS: AMD64
    Kubernetes Cluster:
  • Cloud Provider: other
  • Kubernetes Version:
Client Version: v1.30.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.6+k3s2
k3d version v5.7.2
k3s version v1.29.6-k3s2 (default)

Anything else we need to know?

Dockerfile

FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get -qq update && \
    apt-get -qq install -y ca-certificates \
                curl \
                iproute2 \
                net-tools \
                htop \
                mtr-tiny

ADD ./bin/payment /bin/payment

ENTRYPOINT ["/bin/payment"]

Building go binary in Makefile

build-go:
  go build -o ./bin/payment ./cmd/payment
@lee-aaron lee-aaron added the kind/bug Something isn't working label Jul 21, 2024
@lee-aaron
Copy link
Author

Is this because only kind is supported?

Copy link

Currently, it's only supported with kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants