Zum Inhalt

The Developer Workspace

VS Code

Prerequisites

  • A running application installation that will provide a deployment as a workspace template.

Workspace Setup

Take the sample YAML configuration and modify it:

  • Look up the deployment name of your application and add it to use CRD as "deployment" under spec
  • Enter your SSH public key, email, name and the desired container image
  • Save your customized YAML configuration somewhere. Keep it for future reference.
  • Open the Kubernetes console and add the CRD

Sample YAML to create a developer workspace

apiVersion: xrow.com/v2
kind: Developer
metadata:
  name: bjoern-dieding
  namespace: ibexa-test
spec:
  deployment: test-ibexa-frontend
  key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOXGvbBWWfPKoMEU8zKMaKGLocGLVMAq4K24UZMyzjmc"
  email: "bjoern@xrow.de"
  name: "Björn Dieding"
  env:
    - name: APP_ENV
      value: dev
    - name: APP_DEBUG
      value: "1"

Port Forward to your local maschine

Just the ssh and the webserver ports are really important.

kubectl config use-context 08.xrow.net
kubectl config set-context --current --namespace=project-test 
kubectl port-forward service/bjoern-dieding 2222:2222 &
kubectl port-forward service/bjoern-dieding 8080:8080 &
kubectl port-forward service/bjoern-dieding 8443:8443 &
kubectl port-forward service/$(kubectl get service | grep solr | awk '{print $1}') 8983:8983 &
kubectl port-forward service/$(kubectl get service | grep mysql | awk '{print $1}') 3306:3306 &

Alternativly you can forward with a tool like kubefwd

Connect to the Pod / development environment via an SSH Agent

Linux: Connect via SSH

[root@host ~]# ssh root@127.0.0.1 -p 2222 -A
Last login: Tue Feb 18 00:37:33 2020 from 10.128.0.1
Hi Björn Dieding <bjoern@xrow.de>, you can start coding
-bash-4.2$ ssh -T git@gitlab.com
Warning: Permanently added 'gitlab.com,35.231.145.151' (ECDSA) to the list of known hosts.
Welcome to GitLab, @xrow!

Connect via VS CODE

  • Use the vscode kubernetes extension
  • Select the desired SVC or POD and select forward all

Start to code

  • For best expirience make sure a .git folder is present in the workdir.
  • Modify any file and commit to git.
  • Start an addtional dev server if needed. In the example it is a node dev server.
yarn install
$(yarn bin)/encore dev-server --host 0.0.0.0 --port 9000 --config-name ibexa --allowed-hosts 192.168.222.2 --public http://192.168.222.2:9000/