kubernetes: Lifecycle preStop hook not working when using https

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened: Trying to delete a pod that has configured a preStop hook using HTTPS scheme I got the following error:

Warning  FailedPreStopHook      27s   kubelet, gke-slingr-dev-default-pool-c58edf43-bvg3  Http lifecycle hook (/api/system/terminate) for Container "account-manager" in Pod "account-manager-deployment-4edu-5dbc6757c8-xzd7m_default(1d59a4fe-bdb4-11e8-9ab6-42010a8001d0)" failed - error: Get http://10.52.4.10:8443/api/system/terminate: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x03\x00\x02\x02P", message: ""

What you expected to happen: The hook should be properly called it. The full url should be: https://10.52.4.10:8443/api/system/terminate

How to reproduce it (as minimally and precisely as possible): Setting a lifecycle prestop hook like this:

"lifecycle": {
    "preStop": {
        "httpGet": {
            "path": "/api/system/terminate",
            "port": 8443,
            "scheme": "HTTPS",
            "httpHeaders": [
                {
                    "name": "token",
                    "value": "260d22862598eabcbb8d9366c5caf058521d9593"
                }
            ]
        }
    }
}

Anything else we need to know?: Liveness probe is working as expected. Seems like the error is only happening for the preStop hook. Environment:

  • Kubernetes version (use kubectl version): 1.9.7-gke.5
  • Cloud provider or hardware configuration: Google Cloud Platform
  • OS (e.g. from /etc/os-release): Ubuntu 14.04.5 LTS
  • Kernel (e.g. uname -a): Linux 4.4.111+
  • Install tools:
  • Others:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

This problem still persist, is there any workaround available to fix this?