Skip to content

Start right away with a development environment for kubebuilder using Visual Studio Code Remote - Containers

Notifications You must be signed in to change notification settings

alitari/vscode-kubebuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vscode-kubebuilder

Start right away with a development environment for kubebuilder using Visual Studio Code Remote - Containers.

Preparation steps

We assume you have a running docker daemon and a working connection to a kubernetes cluster.

  1. configure vscode in order to be able to use Visual Studio Code Remote - Containers
  2. configure connection to your k8s cluster: copy your kubernetes config file to the .devcontainer directory. e.g. cp ~/.kube/config .devcontainer
  3. use this repo as remote container: Press F1 and select the Remote-Containers: Open Folder in Container... command.

After vscode is has been setup ( can last a few minutes for the first time) check whether all tools are present:

# k8s cluster
kubectl cluster-info
# golang
go version
# docker
docker info
# kubebuilder
kubebuilder version
# kustomize
kustomize version

create a project guestbook ( see kubebuilder-book for details)

create new go module

go mod init guestbook

initialze project framework

kubebuilder init

create API artefacts

kubebuilder create api --group webapp --version v1 --kind Guestbook

install CRDs

make install

run controller

standard with make make run or press F5 for debugging with vscode

install CR

kubectl apply -f config/samples/

build controller image

make docker-build IMG=guestbook-controller:latest

push controller image

You can skip this step when using local cluster. If you have push access rights to the registry:

make docker-push IMG=<registry>/guestbook-controller:latest

Here an example for using docker hub (docker.io):

docker login
docker tag guestbook-controller:latest <dockerhub-username>/guestbook-controller:latest
make docker-push IMG=<dockerhub-username>/guestbook-controller:latest

deploy controller on cluster

make deploy IMG=<dockerhub-username>/guestbook-controller:latest

About

Start right away with a development environment for kubebuilder using Visual Studio Code Remote - Containers

Topics

Resources

Stars

Watchers

Forks