Title: How to Upload a New Certificate to Kong Using decK?
I’m trying to upload a new SSL certificate to Kong using decK, but I’m encountering an error. I can successfully upload certificates using the Kong Admin API, but the same approach doesn’t seem to work with decK.
What I’ve Tried:
-
Generated the Private Key and Certificate:
I generated the private key and self-signed certificate using OpenSSL:
openssl genrsa -out server.key.pem 2048 openssl req -new -key server.key.pem -out server.csr.pem openssl x509 -req -days 365 -in server.csr.pem -signkey server.key.pem -out server.crt.pem
-
Created the YAML Configuration for decK:
I prepared the
kong.yml
file with the certificate and key:_format_version: "2.1" _transform: true certificates: - cert: | -----BEGIN CERTIFICATE----- ...your certificate content... -----END CERTIFICATE----- key: | -----BEGIN RSA PRIVATE KEY----- ...your key content... -----END RSA PRIVATE KEY----- snis: - example.local tags: - example
-
Synced the Configuration with Kong:
I used the following command to apply the configuration to my Kong instance:
deck sync -s kong.yml
Issue:
When I run the deck sync
command, I receive the following error:
```
err=certificates.0: id is required
```
However, the same certificate and key work when uploaded directly via the Kong Admin API using the following command:
```sh
curl -i -X POST http://localhost:8001/certificates
--data "cert=$(cat server.crt.pem)"
--data "key=$(cat server.key.pem)"
--data "snis[]=example.local"
--data "tags[]=example"
```
Question:
How can I successfully upload a new certificate to Kong using decK? Is there something I’m missing in my kong.yml
configuration? Any help or guidance would be greatly appreciated!
Rituraj Tripathy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.