Friday, July 12, 2019

Setup dev environment for k8s operator

The process is to setup k8s operator dev environment

1. Install docker, kubectl, golang and mercurial etc. using the method from each product
2. Setup git config if you have not:
    git config --global user.email "your email address here"
    git config --global user.name "Tong Li"  
3. Add the following to the end of your .profile:

    export PATH=$PATH:/usr/local/go/bin
    export GOROOT=/usr/local/go
    export GOBIN=$GOROOT/bin
    export GOPATH=~/hl
    export GO111MODULE=on
    The above assumes that your golang is installed in to /usr/local/go directory and you have
    a directory in your home named hl

4. To be able to create an operator, you will need to first create a directory under $GOPATH, the run the operator creation command:

   mkdir $GOPATH/myproject
   cd $GOPATH/myproject
   operator-sdk new myfirst

No comments:

Post a Comment