Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit b037631

Browse files
remacrandresmgot
authored andcommitted
Update readme to include kubernetes secrets (#198)
1 parent a31d128 commit b037631

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ Kubeless is a Kubernetes-native Serverless solution.
99
Make sure you have a kubernetes endpoint running and kubeless installed. You can find the installation intructions [here](https://github.com/kubeless/kubeless#installation).
1010

1111
Once you have Kubeless running in your cluster you can install serverless
12+
1213
```bash
1314
$ npm install serverless -g
1415
```
1516

1617
## Try out the example
1718

1819
Clone this repo and check the example function
20+
1921
```bash
2022
$ git clone https://github.com/serverless/serverless-kubeless
2123
$ cd examples/get-python
@@ -36,11 +38,13 @@ functions:
3638
```
3739

3840
Download dependencies
41+
3942
```bash
4043
$ npm install
4144
```
4245

4346
Deploy function.
47+
4448
```bash
4549
$ serverless deploy
4650
Serverless: Packaging service...
@@ -50,6 +54,7 @@ Serverless: Function hello successfully deployed
5054
```
5155

5256
The function will be deployed to k8s via kubeless.
57+
5358
```bash
5459
$ kubectl get function
5560
NAME KIND
@@ -61,6 +66,7 @@ hello-1815473417-1ttt7 1/1 Running 0 1m
6166
```
6267

6368
Now you will be able to call the function:
69+
6470
```bash
6571
$ serverless invoke -f hello -l
6672
Serverless: Calling function: hello...
@@ -69,6 +75,7 @@ hello world
6975
```
7076

7177
You can also check the logs for the function:
78+
7279
```bash
7380
$ serverless logs -f hello
7481
172.17.0.1 - - [12/Jul/2017:09:47:18 +0000] "GET /healthz HTTP/1.1" 200 2 "" "Go-http-client/1.1" 0/118
@@ -78,6 +85,7 @@ $ serverless logs -f hello
7885
```
7986

8087
Or you can obtain the function information:
88+
8189
```bash
8290
$ serverless info
8391
Service Information "hello"
@@ -97,22 +105,44 @@ Dependencies:
97105
```
98106

99107
You can access the function through its HTTP interface as well using `kubectl proxy` and accessing:
108+
100109
```bash
101110
$ curl http://127.0.0.1:8001/api/v1/namespaces/default/services/hello/proxy/
102111
hello world
103112
```
104113

105114
If you have a change in your function and you want to redeploy it you can run:
115+
106116
```bash
107117
$ serverless deploy function -f hello
108118
Serverless: Redeploying hello...
109119
Serverless: Function hello successfully deployed
110120
```
111121

112122
Finally you can remove the function.
123+
113124
```bash
114125
$ serverless remove
115126
Serverless: Removing function: hello...
116127
Serverless: Function hello successfully deleted
117128
```
118129

130+
## Kubernetes secrets
131+
132+
Kubernetes secret objects let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys.
133+
Putting this information in a secret is safer and more flexible than putting it verbatim in a Pod definition or in a container image. To use secrets follow the next steps:
134+
135+
1. Create a K8s secret:
136+
`kubectl create secret generic secret-file --from-file=secret.txt -n namespace-name`
137+
138+
2. Add the secret key into the provider definition in the serverless.yml file below the `secrets` key. You can specify an array of secrets and they will be mounted at root level in the pod file system using the path `/<secret-name>`:
139+
140+
```yaml
141+
provider:
142+
name: kubeless
143+
....
144+
secrets:
145+
- secret-file
146+
```
147+
148+
3. Now inside your pod, you will be able to access the route `/secret-file/secret.txt`.

0 commit comments

Comments
 (0)