Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the token-auth example for getting-started. #4772

Merged
merged 2 commits into from
May 25, 2022

Conversation

absoludity
Copy link
Contributor

Signed-off-by: Michael Nelson minelson@vmware.com

Description of the change

With 1.24, token secrets are not created automatically for a service account. Updated our getting started to create the secret with the required annotation to be populated with a valid token, and update the instructions to just get that token (more simple anyway).

Verified this works both with k8s 1.24 and 1.21 .

Benefits

Avoid confusion with token auth moving forward as more people use 1.24

Possible drawbacks

Applicable issues

Additional information

Signed-off-by: Michael Nelson <minelson@vmware.com>
@netlify
Copy link

netlify bot commented May 24, 2022

Deploy Preview for kubeapps-dev ready!

Name Link
🔨 Latest commit b10d6f1
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/628d712934d2cc0008b242cc
😎 Deploy Preview https://deploy-preview-4772--kubeapps-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Wouter053
Copy link

@absoludity when I try the instructions I see in the preview they are identical to what they were,
image
and do not work on 1.24.
image

There is no token being created. You have to create one explicitly it in a separate command:

kubectl create -f token.yml

token.yml:


apiVersion: v1
kind: Secret
metadata:
   namespace: default
   name: operator-secret
   annotations:
       kubernetes.io/service-account.name: "kubeapps-operator"
type: kubernetes.io/service-account-token

Comment on lines +32 to 42
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: kubeapps-operator-token
namespace: default
annotations:
kubernetes.io/service-account.name: kubeapps-operator
type: kubernetes.io/service-account-token
EOF
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we also have these instructions replictated in the website, I guess we would need to update this file as well: https://github.com/vmware-tanzu/kubeapps/blob/main/site/themes/template/layouts/partials/use-cases.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I'll check the demo website once updated.

@@ -6,6 +6,7 @@
KUBE ?= ${HOME}/.kube
CLUSTER_NAME ?= kubeapps
ADDITIONAL_CLUSTER_NAME ?= kubeapps-additional
IMAGE ?= kindest/node:v1.24.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind recommends using the very exact image tag for each Kind version. However, as we can change it just setting IMAGE is not a big deal. Perhaps this image also works out of the box.

https://github.com/kubernetes-sigs/kind/releases

New Node images have been built for kind v0.12.0, please use these exact images (IE like ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'll update to the exact image - easy to set in the Makefile and we can do what we like when we override (as I did to test out 1.21).

@@ -48,7 +58,7 @@ kubectl get --namespace default secret $(kubectl get --namespace default service
Open a Powershell terminal and run:

```powershell
[Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(kubectl get --namespace default secret $(kubectl get --namespace default serviceaccount kubeapps-operator -o jsonpath='{.secrets[].name}') -o jsonpath='{.data.token}')))
[Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(kubectl get --namespace default secret kubeapps-operator-token -o jsonpath='{.data.token}')))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a try soon just to double-check it works

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking the powershell :)

Signed-off-by: Michael Nelson <minelson@vmware.com>
@absoludity
Copy link
Contributor Author

@absoludity when I try the instructions I see in the preview they are identical to what they were, image and do not work on 1.24.

Hi @Wouter053 . The instructions that I'd changed in my first commit were in the getting-started.md, but yes, I'd missed updating the similar section presented on the website (hence it not changing). I've done that in the second commit :)

@absoludity absoludity merged commit 1f0807c into vmware-tanzu:main May 25, 2022
@absoludity absoludity deleted the k8s1.24-dev branch May 25, 2022 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify kubeapps token instructions after SA change in k8s >=1.24
4 participants