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
$ TOKEN=$(kubectl -n test-jobs get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='executor')].data.token}"| base64 --decode)
36
40
$ kubectl run "get-pods-example" \
37
41
--rm="true" \
38
42
--restart="Never" \
39
43
--image="4ops/kubectl:1.18.2" \
40
-
--image-pull-policy="Always" \
41
44
--stdin \
42
45
--tty \
43
-
--namespace="test-jobs" \
44
-
--env="TOKEN=$TOKEN" \
45
46
-- \
46
-
--token='$(TOKEN)' \
47
47
get \
48
48
pods
49
49
```
50
+
51
+
Pod manifest example:
52
+
53
+
```YAML
54
+
apiVersion: v1
55
+
kind: Pod
56
+
metadata:
57
+
name: get-pods-example
58
+
spec:
59
+
containers:
60
+
- name: "kubectl"
61
+
image: "4ops/kubectl:1.18.2"
62
+
args: ["get", "pods"]
63
+
```
64
+
65
+
# Credentials
66
+
67
+
## Using existing kubeconfig
68
+
69
+
- Mount volume with kubeconfig file
70
+
- Setup path to kubeconfig using environment variable `KUBECONFIG`
71
+
72
+
## Using ServiceAccount token
73
+
74
+
- Setup token as environment variable `KUBE_TOKEN`
75
+
- If no `KUBECONFIG` or `KUBE_TOKEN` set, entrypoint script will try to discover ServiceAccount secrets from `/var/run/secrets/kubernetes.io/serviceaccount` directory
76
+
77
+
# Environment variables
78
+
79
+
- `KUBECONFIG` - path to kubeconfig file (default: `/config/kubectl.conf`)
80
+
- `KUBERNETES_SERVICE_HOST`, `KUBERNETES_SERVICE_PORT` - Kubernetes API native service discovery [variables](https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables) (default: `kubernetes.default.svc`, `443`)
81
+
- `KUBE_URL`- custom Kubernetes API URL
82
+
- `KUBE_CA_PEM`- PEM-encoded certificate (or path to cert file) for TLS verification
83
+
- `KUBE_NAMESPACE` - default namespace for kubeconfig context (default: `default`)
0 commit comments