-3

I am trying Egress Operator for restricting the egress calls based on domain. I am using Ubuntu 18 Hyper-V VM and I have all prerequisites:

  1. Azure repository to push images
  2. Kubebuilder for code generation
  3. Kustomize for building the Kubernetes manifests
  4. CoreDns (default with k3s) pod running
  5. Golang : go version go1.16.5 linux/amd64

But while Testing locally make run is giving below error:

root@Ubuntu18-Virtual-Machine:~/egress-operator# make run
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths="./..."
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH

Also after editing coredns deployment and coredns Corefile in ConfigMap, as mentioned in coredns plugin setup I am seeing blow error while executing make deploy command:

root@Ubuntu18-Virtual-Machine:~/egress-operator# make deploy IMG=MY_REPO/egress-operator:v0.1
go: creating new go.mod: module tmp
go get: added sigs.k8s.io/controller-tools v0.2.4
/root/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
Error: go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags ignore_autogenerated -- ./...]: exit status 2: # runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH

Can someone let me know how to resolve this ?

solveit
  • 869
  • 2
  • 12
  • 32

1 Answers1

3

It looks like your environment doesn't have the gcc compiler installed. Please try this as follows:

sudo apt-get install build-essential

or

sudo apt-get  build-dep  gcc

Then check if the installation is successful:

gcc --version

See also this similar problem.

Mikołaj Głodziak
  • 4,775
  • 7
  • 28