Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --v=3 does not return valid json for config #12330

Open
soupdiver opened this issue Nov 8, 2024 · 2 comments
Open

Using --v=3 does not return valid json for config #12330

soupdiver opened this issue Nov 8, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@soupdiver
Copy link

What happened:

To debug a configuration issue I added --v=3 to the pod to get the used configuration.

What you expected to happen:
According to the docs (https://kubernetes.github.io/ingress-nginx/troubleshooting/#debug-logging) the output should be in json format.

The output it not valid json.

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.): 1.11.3

  • Others:
    Snippet of my output:
"NGINX" configuration="{\"ProxySetHeaders\":{},\"AddHeaders\":{},\"BacklogSize\":4096,\"Backends\":[{\"name\":\"argocd-argocd-server-443\",\"service\":{\"metadata\":{\"name\":\"argocd-server\",\"namespace\":\"argocd\",\"uid\":\"43aca71d-7367-4c23-a9a2-5392b8697ede\",\"resourceVersion\":\"573228177\",\"creationTimestamp\":\"2023-01-04T17:30:59Z\",\"labels\":{\"app.kubernetes.io/component\":\"server\",\"app.kubernetes.io/instance\":\"argocd\",\"app.kubernetes.io/managed-by\":\"Helm\",\"app.kubernetes.io/name\":\"argocd-server\",\"app.kubernetes.io/part-of\":\"argocd\",\"app.kubernetes.io/version\":\"v2.9.3\",\"argocd.argoproj.io/instance\":\"argocd\",\"helm.sh/chart\":\"argo-cd-5.51.3\"},\"annotations\":{\"kubectl.kubernetes.io/last-applied-configuration\":\"{\\\"apiVersion\\\":\\\"v1\\\",\\\"kind\\\":\\\"Service\\\",\\\"metadata\\\":{\\\"annotations\\\":{},\\\"labels\\\":{\\\"app.kubernetes.io/component\\\":\\\"server\\\",\\\"app.kubernetes.io/instance\\\":\\\"argocd\\\",\\\"app.kubernetes.io/managed-by\\\":\\\"Helm\\\",\\\"app.kubernetes.i
...

I mean the bunch of \ would be easy to fix but it seems it just dump a k8s object. Unfortunately there are things like labels in there that I don't think belong to the nginx config iteself and then there is the last-applied-configuration which is embedded json and maybe this breaks it.

Would be nice to get an easy way to debug the config.

How to reproduce this issue:
Use --v=3

Anything else we need to know:
The resulting config is around 2k lines with a bunch of hosts so it's hard to format by hand

@soupdiver soupdiver added the kind/bug Categorizes issue or PR as related to a bug. label Nov 8, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Nov 8, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@longwuyuan
Copy link
Contributor

% k -n ingress-nginx get po ingress-nginx-controller-7d978dd4c-kjhtj -v=8
I1110 08:27:36.472394 61107 loader.go:395] Config loaded from file: /home/me/.kube/config
I1110 08:27:36.472829 61107 cert_rotation.go:137] Starting client certificate rotation controller
I1110 08:27:36.475402 61107 round_trippers.go:463] GET https://192.168.58.2:8443/api/v1/namespaces/ingress-nginx/pods/ingress-nginx-controller-7d978dd4c-kjhtj
I1110 08:27:36.475411 61107 round_trippers.go:469] Request Headers:
I1110 08:27:36.475418 61107 round_trippers.go:473] User-Agent: kubectl/v1.30.2 (linux/amd64) kubernetes/3968350
I1110 08:27:36.475422 61107 round_trippers.go:473] Accept: application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8s.io,application/json
I1110 08:27:36.479631 61107 round_trippers.go:574] Response Status: 200 OK in 4 milliseconds
I1110 08:27:36.479645 61107 round_trippers.go:577] Response Headers:
I1110 08:27:36.479653 61107 round_trippers.go:580] Date: Sun, 10 Nov 2024 02:57:36 GMT
I1110 08:27:36.479659 61107 round_trippers.go:580] Audit-Id: 054c3ce7-4060-4a46-8551-c6aea895bcdb
I1110 08:27:36.479663 61107 round_trippers.go:580] Cache-Control: no-cache, private
I1110 08:27:36.479667 61107 round_trippers.go:580] Content-Type: application/json
I1110 08:27:36.479673 61107 round_trippers.go:580] X-Kubernetes-Pf-Flowschema-Uid: fd80cf0e-0c0e-481e-a769-f1865db13b69
I1110 08:27:36.479679 61107 round_trippers.go:580] X-Kubernetes-Pf-Prioritylevel-Uid: 2ad8acd0-3ef7-41c9-88b1-387bf1a3ac28
I1110 08:27:36.479779 61107 request.go:1212] Response Body: {"kind":"Table","apiVersion":"meta.k8s.io/v1","metadata":{"resourceVersion":"342205"},"columnDefinitions":[{"name":"Name","type":"string","format":"name","description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names","priority":0},{"name":"Ready","type":"string","format":"","description":"The aggregate readiness state of this pod for accepting traffic.","priority":0},{"name":"Status","type":"string","format":"","description":"The aggregate status of the containers in this pod.","priority":0},{"name":"Restarts","type":"string","format":"","description":"The number of times the containers in this pod have been restarted and when the last container in this pod has restarted.","priority":0},{ [truncated 6458 chars]
NAME READY STATUS RESTARTS AGE
ingress-nginx-controller-7d978dd4c-kjhtj 1/1 Running 2 (10m ago) 5d19h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

3 participants