mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/openvpn] README scripts reflect new labels (#5402)
- Update readme instructions to work with the new labels introduced in 3.0.0. - Quote bash variables to avoid word splitting
This commit is contained in:
committed by
k8s-ci-robot
parent
0c3fe737aa
commit
ef78db8024
@@ -3,7 +3,7 @@ description: A Helm chart to install an openvpn server inside a kubernetes clust
|
||||
generation is also part of the deployment, and this chart will generate client keys
|
||||
as needed.
|
||||
name: openvpn
|
||||
version: 3.2.0
|
||||
version: 3.2.1
|
||||
appVersion: 1.1.0
|
||||
maintainers:
|
||||
- name: jfelten
|
||||
|
||||
+12
-11
@@ -14,11 +14,11 @@ helm install stable/openvpn
|
||||
Wait for the external load balancer IP to become available. Check service status via: `kubectl get svc`
|
||||
|
||||
Please be aware that certificate generation is variable and may take some time (minutes).
|
||||
Check pod status via:
|
||||
Check pod status, replacing `$HELM_RELEASE` with the name of your release, via:
|
||||
|
||||
```bash
|
||||
POD_NAME=$(kubectl get pods -l type=openvpn -o jsonpath='{.items[0].metadata.name}') \
|
||||
&& kubectl log $POD_NAME --follow
|
||||
POD_NAME=$(kubectl get pods -l "app=openvpn,release=$HELM_RELEASE" -o jsonpath='{.items[0].metadata.name}') \
|
||||
&& kubectl log "$POD_NAME" --follow
|
||||
```
|
||||
|
||||
When all components of the openvpn chart have started use the following script to generate a client key:
|
||||
@@ -26,19 +26,20 @@ When all components of the openvpn chart have started use the following script t
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 1 ]
|
||||
if [ $# -ne 3 ]
|
||||
then
|
||||
echo "Usage: $0 <CLIENT_KEY_NAME>"
|
||||
echo "Usage: $0 <CLIENT_KEY_NAME> <NAMESPACE> <HELM_RELEASE>"
|
||||
exit
|
||||
fi
|
||||
|
||||
KEY_NAME=$1
|
||||
NAMESPACE=$(kubectl get pods --all-namespaces -l type=openvpn -o jsonpath='{.items[0].metadata.namespace}')
|
||||
POD_NAME=$(kubectl get pods -n $NAMESPACE -l type=openvpn -o jsonpath='{.items[0].metadata.name}')
|
||||
SERVICE_NAME=$(kubectl get svc -n $NAMESPACE -l type=openvpn -o jsonpath='{.items[0].metadata.name}')
|
||||
SERVICE_IP=$(kubectl get svc -n $NAMESPACE $SERVICE_NAME -o go-template='{{range $k, $v := (index .status.loadBalancer.ingress 0)}}{{$v}}{{end}}')
|
||||
kubectl -n $NAMESPACE exec -it $POD_NAME /etc/openvpn/setup/newClientCert.sh $KEY_NAME $SERVICE_IP
|
||||
kubectl -n $NAMESPACE exec -it $POD_NAME cat /etc/openvpn/certs/pki/$KEY_NAME.ovpn > $KEY_NAME.ovpn
|
||||
NAMESPACE=$2
|
||||
HELM_RELEASE=$3
|
||||
POD_NAME=$(kubectl get pods -n "$NAMESPACE" -l "app=openvpn,release=$HELM_RELEASE" -o jsonpath='{.items[0].metadata.name}')
|
||||
SERVICE_NAME=$(kubectl get svc -n "$NAMESPACE" -l "app=openvpn,release=$HELM_RELEASE" -o jsonpath='{.items[0].metadata.name}')
|
||||
SERVICE_IP=$(kubectl get svc -n "$NAMESPACE" "$SERVICE_NAME" -o go-template='{{range $k, $v := (index .status.loadBalancer.ingress 0)}}{{$v}}{{end}}')
|
||||
kubectl -n "$NAMESPACE" exec -it "$POD_NAME" /etc/openvpn/setup/newClientCert.sh "$KEY_NAME" "$SERVICE_IP"
|
||||
kubectl -n "$NAMESPACE" exec -it "$POD_NAME" cat "/etc/openvpn/certs/pki/$KEY_NAME.ovpn" > "$KEY_NAME.ovpn"
|
||||
```
|
||||
|
||||
Be sure to change `KEY_NAME` if generating additional keys. Import the .ovpn file into your favorite openvpn tool like tunnelblick and verify connectivity.
|
||||
|
||||
@@ -14,11 +14,11 @@ You set the service type to NodePort, port {{ .Values.service.nodePort }} will b
|
||||
{{ end }}
|
||||
Once the external IP is available and all the server certificates are generated create client key .ovpn files by pasting the following into a shell:
|
||||
|
||||
POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "openvpn.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }')
|
||||
SERVICE_NAME=$(kubectl get svc --namespace {{ .Release.Namespace }} -l "app={{ template "openvpn.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }')
|
||||
SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} $SERVICE_NAME {{"-o go-template='{{ range $k, $v := (index .status.loadBalancer.ingress 0)}}{{ $v }}{{end}}'"}})
|
||||
POD_NAME=$(kubectl get pods --namespace "{{ .Release.Namespace }}" -l "app={{ template "openvpn.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }')
|
||||
SERVICE_NAME=$(kubectl get svc --namespace "{{ .Release.Namespace }}" -l "app={{ template "openvpn.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }')
|
||||
SERVICE_IP=$(kubectl get svc --namespace "{{ .Release.Namespace }}" "$SERVICE_NAME" {{"-o go-template='{{ range $k, $v := (index .status.loadBalancer.ingress 0)}}{{ $v }}{{end}}'"}})
|
||||
KEY_NAME=kubeVPN
|
||||
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME /etc/openvpn/setup/newClientCert.sh $KEY_NAME $SERVICE_IP
|
||||
kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME cat /etc/openvpn/certs/pki/$KEY_NAME.ovpn > $KEY_NAME.ovpn
|
||||
kubectl --namespace "{{ .Release.Namespace }}" exec -it "$POD_NAME" /etc/openvpn/setup/newClientCert.sh "$KEY_NAME" "$SERVICE_IP"
|
||||
kubectl --namespace "{{ .Release.Namespace }}" exec -it "$POD_NAME" cat "/etc/openvpn/certs/pki/$KEY_NAME.ovpn" > "$KEY_NAME.ovpn"
|
||||
|
||||
Copy the resulting $KEY_NAME.ovpn file to your open vpn client (ex: in tunnelblick, just double click on the file). Do this for each user that needs to connect to the VPN. Change KEY_NAME for each additional user.
|
||||
|
||||
Reference in New Issue
Block a user