You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
xpumanager sidecar: remove HTTPS use without certificates
Add deployment that uses cert-manager to provide self-signed certificates
Add functionality to verify server endpoint in the sidecar
Signed-off-by: Tuomas Katila <[email protected]>
Please see XPU Manager Kubernetes files for additional info on [installation](https://github.com/intel/xpumanager/tree/master/deployment/kubernetes).
@@ -60,7 +60,7 @@ Please see XPU Manager Kubernetes files for additional info on [installation](ht
60
60
Use patch to add sidecar into the XPU Manager daemonset.
NOTE: The sidecar patch will remove other resources from the XPU Manager container. If your XPU Manager daemonset is using, for example, the smarter device manager resources, those will be removed.
@@ -76,7 +76,25 @@ master,0.0-1.0_0.1-1.1
76
76
77
77
### Use HTTPS with XPU Manager
78
78
79
-
XPU Manager can be configured to use HTTPS on the metrics interface. For the gunicorn sidecar, cert and key files have to be added to the command:
79
+
There is an alternative deployment that uses HTTPS instead of HTTP. The reference deployment requires `cert-manager` to provide a certificate for TLS. To deploy:
The deployment requests a certificate and key from `cert-manager`. They are then provided to the gunicorn container as secrets and are used in the HTTPS interface. The sidecar container uses the same certificate to verify the server.
86
+
87
+
> *NOTE*: The HTTPS deployment uses self-signed certificates. For production use, the certificates should be properly set up.
88
+
89
+
<details>
90
+
<summary>Enabling HTTPS manually</summary>
91
+
92
+
If one doesn't want to use `cert-manager`, the same can be achieved manually by creating certificates with openssl and then adding it to the deployment. The steps are roughly:
93
+
1) Create a certificate with [openssl](https://www.linode.com/docs/guides/create-a-self-signed-tls-certificate/)
94
+
1) Create a secret from the [certificate & key](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_tls/).
95
+
1) Change the deployment:
96
+
97
+
* Add certificate and key to gunicorn container:
80
98
```
81
99
- command:
82
100
- gunicorn
@@ -87,8 +105,7 @@ XPU Manager can be configured to use HTTPS on the metrics interface. For the gun
87
105
- xpum_rest_main:main()
88
106
```
89
107
90
-
The gunicorn container will also need the tls.crt and tls.key files within the container. For example:
91
-
108
+
* Add secret mounting to the Pod:
92
109
```
93
110
containers:
94
111
- name: python-exporter
@@ -101,44 +118,19 @@ The gunicorn container will also need the tls.crt and tls.key files within the c
101
118
secret:
102
119
defaultMode: 420
103
120
secretName: xpum-server-cert
104
-
```
105
-
106
-
In this case, the secret providing the certificate and key is called `xpum-server-cert`.
107
-
108
-
The certificate and key can be [added manually to a secret](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_tls/). Another way to achieve a secret is to leverage [cert-manager](https://cert-manager.io/).
109
-
110
-
<details>
111
-
<summary>Example for the Cert-manager objects</summary>
112
-
113
-
Cert-manager will create a self-signed certificate and the private key, and store them into a secret called `xpum-server-cert`.
121
+
```
114
122
123
+
* Add use-https and cert to sidecar
115
124
```
116
-
apiVersion: cert-manager.io/v1
117
-
kind: Issuer
118
-
metadata:
119
-
name: selfsigned-issuer
120
-
spec:
121
-
selfSigned: {}
122
-
---
123
-
apiVersion: cert-manager.io/v1
124
-
kind: Certificate
125
-
metadata:
126
-
name: serving-cert
127
-
spec:
128
-
dnsNames:
129
-
- xpum.svc
130
-
- xpum.svc.cluster.local
131
-
issuerRef:
132
-
kind: Issuer
133
-
name: selfsigned-issuer
134
-
secretName: xpum-server-cert
125
+
name: xelink-sidecar
126
+
volumeMounts:
127
+
- mountPath: /certs
128
+
name: certs
129
+
readOnly: true
130
+
args:
131
+
...
132
+
- --cert=/certs/tls.crt
133
+
...
135
134
```
136
135
137
136
</details>
138
-
139
-
For the XPU Manager sidecar, `use-https` has to be added to the arguments. Then the sidecar will leverage HTTPS with the connection to the metrics interface.
0 commit comments