krelay icon indicating copy to clipboard operation
krelay copied to clipboard

--server.namespace fails unless default namespace is used

Open sergeykad opened this issue 2 years ago • 4 comments

If I don't execute kubectl config set-context --current --namespace="$ENVIRONMENT" before creating a relay, an error occurs. However, when the default namespace is set, the process works correctly.

The relay command is kubectl relay --server.namespace "$ENVIRONMENT" "service/$service" "$ports" --address 0.0.0.0

The error is Error: ensure krelay-server: create krelay-server pod: pods is forbidden: User "foobar" cannot create resource "pods" in API group "" in the namespace "default"

sergeykad avatar Jul 26 '23 15:07 sergeykad

The error message indicates that you are not allowed to create pod in the "default" namespace.

krelay will create the krelay-server pod in the namespace specified by the flag --server.namespace. If the value of $ENVIRONMENT was not default, I have no clue why such error occurred.

@sergeykad Could you post the output of kubectl relay --server.namespace "$ENVIRONMENT" "service/$service" "$ports" --address 0.0.0.0 -v=7 to help us see what happens?

knight42 avatar Jul 27 '23 02:07 knight42

I am attaching the -v=7 output below

The value of the $ENVIRONMENT was not default but a name of an actual namespace. The user has permission to the $ENVIRONMENT namespace but not to default

Log

I0727 16:34:30.191615 765770 loader.go:372] Config loaded from file: /home/foobar/.kube/config I0727 16:34:30.192624 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/api?timeout=32s I0727 16:34:30.192635 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.192656 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.192666 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.211684 765770 round_trippers.go:574] Response Status: 200 OK in 18 milliseconds I0727 16:34:30.222932 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis?timeout=32s I0727 16:34:30.222953 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.222970 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.222983 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.224675 765770 round_trippers.go:574] Response Status: 200 OK in 1 milliseconds I0727 16:34:30.228402 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/monitoring.coreos.com/v1alpha1?timeout=32s I0727 16:34:30.228412 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228415 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/apm.k8s.elastic.co/v1?timeout=32s I0727 16:34:30.228432 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228448 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228460 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228465 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/apm.k8s.elastic.co/v1beta1?timeout=32s I0727 16:34:30.228471 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228485 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228493 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228595 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/enterprisesearch.k8s.elastic.co/v1beta1?timeout=32s I0727 16:34:30.228617 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228644 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228603 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/kibana.k8s.elastic.co/v1?timeout=32s I0727 16:34:30.228659 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/apiregistration.k8s.io/v1?timeout=32s I0727 16:34:30.228470 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/flowcontrol.apiserver.k8s.io/v1beta1?timeout=32s I0727 16:34:30.228685 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228688 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228701 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228707 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/elasticsearch.k8s.elastic.co/v1?timeout=32s I0727 16:34:30.228719 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228723 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228737 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/kafka.strimzi.io/v1alpha1?timeout=32s I0727 16:34:30.228751 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228760 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228791 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228822 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228850 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/elasticsearch.k8s.elastic.co/v1beta1?timeout=32s I0727 16:34:30.228885 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/events.k8s.io/v1?timeout=32s I0727 16:34:30.228895 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228908 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228662 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228924 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/core.strimzi.io/v1beta2?timeout=32s I0727 16:34:30.228945 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228962 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228973 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/maps.k8s.elastic.co/v1alpha1?timeout=32s I0727 16:34:30.228999 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229016 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/beat.k8s.elastic.co/v1beta1?timeout=32s I0727 16:34:30.229027 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/authentication.k8s.io/v1?timeout=32s I0727 16:34:30.229067 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/monitoring.coreos.com/v1?timeout=32s I0727 16:34:30.229091 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/scheduling.k8s.io/v1?timeout=32s I0727 16:34:30.229104 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/storage.k8s.io/v1beta1?timeout=32s I0727 16:34:30.229115 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/node.k8s.io/v1?timeout=32s I0727 16:34:30.229124 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/crd.projectcalico.org/v1?timeout=32s I0727 16:34:30.228721 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229150 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229169 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229551 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/networking.k8s.io/v1?timeout=32s I0727 16:34:30.229584 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229595 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/admissionregistration.k8s.io/v1?timeout=32s I0727 16:34:30.229634 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229659 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229676 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229689 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229717 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/rbac.authorization.k8s.io/v1?timeout=32s I0727 16:34:30.229734 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229735 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/coordination.k8s.io/v1?timeout=32s I0727 16:34:30.229129 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229761 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229786 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229794 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229802 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229811 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229689 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/flowcontrol.apiserver.k8s.io/v1beta2?timeout=32s I0727 16:34:30.229835 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229854 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229865 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/apiextensions.k8s.io/v1?timeout=32s I0727 16:34:30.229883 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229119 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229152 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/batch/v1?timeout=32s I0727 16:34:30.229924 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/discovery.k8s.io/v1?timeout=32s I0727 16:34:30.229917 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229936 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229946 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229950 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229879 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/authorization.k8s.io/v1?timeout=32s I0727 16:34:30.229993 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.230008 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229369 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/storage.k8s.io/v1?timeout=32s I0727 16:34:30.229953 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230085 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/certificates.k8s.io/v1?timeout=32s I0727 16:34:30.230087 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230120 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230101 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229815 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/autoscaling/v2?timeout=32s I0727 16:34:30.230155 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230161 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.230174 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229750 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230194 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229095 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229872 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229072 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229048 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228886 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229026 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/api/v1?timeout=32s I0727 16:34:30.228979 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228475 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/metrics.k8s.io/v1beta1?timeout=32s I0727 16:34:30.228667 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.228922 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.228421 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.228415 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/apps/v1?timeout=32s I0727 16:34:30.229030 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/kafka.strimzi.io/v1beta2?timeout=32s I0727 16:34:30.229012 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/autoscaling.k8s.elastic.co/v1alpha1?timeout=32s I0727 16:34:30.229026 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229012 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/autoscaling/v2beta2?timeout=32s I0727 16:34:30.229083 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/kafka.strimzi.io/v1beta1?timeout=32s I0727 16:34:30.229109 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229136 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229696 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.229759 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/agent.k8s.elastic.co/v1alpha1?timeout=32s I0727 16:34:30.230871 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.229899 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230893 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.229906 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/enterprisesearch.k8s.elastic.co/v1?timeout=32s I0727 16:34:30.230909 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.230031 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230929 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.230909 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230943 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230897 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230062 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.230037 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/kibana.k8s.elastic.co/v1beta1?timeout=32s I0727 16:34:30.230118 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/policy/v1?timeout=32s I0727 16:34:30.230179 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231375 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231386 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231397 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231408 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231419 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231431 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231435 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231446 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231456 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/trident.netapp.io/v1?timeout=32s I0727 16:34:30.231504 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231515 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231538 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231552 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231566 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231578 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231568 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231609 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231577 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231638 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231649 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231678 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231703 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231728 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231761 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231773 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231805 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231454 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231846 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231862 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231867 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231875 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231885 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231887 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231895 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231919 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231683 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231944 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231803 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231954 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231961 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231972 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231593 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.231992 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.231994 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.232074 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.230120 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231639 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.232101 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.232117 765770 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds I0727 16:34:30.232140 765770 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds I0727 16:34:30.231707 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.231026 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.232165 765770 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds I0727 16:34:30.232180 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.232197 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.232225 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.231811 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.232181 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.232198 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231838 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.231608 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/apis/autoscaling/v1?timeout=32s I0727 16:34:30.232305 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.232322 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.232338 765770 round_trippers.go:473] User-Agent: kubectl-relay/v0.0.0 (linux/amd64) kubernetes/$Format I0727 16:34:30.232510 765770 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds I0727 16:34:30.233253 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.233626 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.234183 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.234416 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.234415 765770 round_trippers.go:574] Response Status: 200 OK in 3 milliseconds I0727 16:34:30.234429 765770 round_trippers.go:574] Response Status: 200 OK in 4 milliseconds I0727 16:34:30.236002 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237355 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237363 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237375 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237386 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237396 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237358 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237404 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237423 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.237428 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.237435 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.237451 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.237453 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.237516 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.238020 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.238025 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.238109 765770 round_trippers.go:574] Response Status: 200 OK in 5 milliseconds I0727 16:34:30.238304 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238345 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238477 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238482 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238503 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238532 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.238963 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.239003 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.239053 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.239046 765770 round_trippers.go:574] Response Status: 200 OK in 6 milliseconds I0727 16:34:30.239374 765770 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds I0727 16:34:30.244364 765770 round_trippers.go:574] Response Status: 200 OK in 12 milliseconds I0727 16:34:30.507593 765770 round_trippers.go:463] GET https://k8s.gaia.server.com:6443/api/v1/namespaces/default/services/dal-entities I0727 16:34:30.507609 765770 round_trippers.go:469] Request Headers: I0727 16:34:30.507620 765770 round_trippers.go:473] Accept: application/json, / I0727 16:34:30.509698 765770 round_trippers.go:574] Response Status: 403 Forbidden in 2 milliseconds Error: services "dal-entities" is forbidden: User "foobar" cannot get resource "services" in API group "" in the namespace "default"

sergeykad avatar Jul 27 '23 13:07 sergeykad

So the actual error is

Error: services "dal-entities" is forbidden: User "foobar" cannot get resource "services" in API group "" in the namespace "default"

That's caused by how krelay works, since you are port-forwarding to a Service in "default" namespace, krelay needs to know the clusterIP by GET the target Service. If you are not allowed to do this, you could try the following:

krelay --server.namespace "$ENVIRONMENT" ip/<your service cluster ip> "$ports" --address 0.0.0.0

knight42 avatar Jul 27 '23 14:07 knight42

I specified the namespace I want to use. Is this configuration ignored? Or there are separate namespaces for krelay and the target service?

Alternatively is it possible to select cluster by name?

The workaround I used works, but it will be nice if krelay will support congratulation similar to port-forward. Otherwise it is a bit confusing to use.

sergeykad avatar Jul 28 '23 08:07 sergeykad