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

docs: create Cloud Shell tutorial for Garden #6

Merged
merged 23 commits into from
May 31, 2023

Conversation

worldofgeese
Copy link
Contributor

@worldofgeese worldofgeese commented May 25, 2023

Use this button to demo:

Open in Cloud Shell

With shortlink:

Open in Cloud Shell

We have two types of quickstart tutorials: the Dashboard-driven experience and following the directions in the docs. Both require users to install tools on their local filesystem and clone the quickstart to get started, increasing friction. With Cloud Shell, a user gets an integrated experience, with a web editor (Eclipse Theia) on one side, and an interactive tutorial pane on the right. The tutorial pane is interactive using Markdown extensions that can do things like spotlight Editor elements and open files when clicked, creating a delightful, user-friendly experience.

Preview of Cloud Shell tutorial experience

Spotlighting UI elements:

Spotlight Cloud Shell element

Notes for reviewer:

I've chosen in this tutorial to use minikube inside a user's Cloud Shell. We can, at our option, also include instructions for provisioning and using a GKE cluster. The advantages to using Cloud Shell for this are that Cloud Shell is already authorized to the user so it's a muck quicker onboarding to the full remote experience. And Cloud Shell can present the GCP project picker inside the tutorial window.

Integrated project picker:

Project picker

@worldofgeese worldofgeese added the documentation Improvements or additions to documentation label May 25, 2023
@worldofgeese worldofgeese force-pushed the feature/ce-33/cloudshell-quickstart branch from c7b32d5 to 1e56264 Compare May 25, 2023 07:37
@worldofgeese
Copy link
Contributor Author

worldofgeese commented May 25, 2023

Running into errors when deploying to a k3d cluster. Can you reproduce @mkhq? Latest commit has all the changes so it's enough to tap the button at the top of this PR and walk through the tutorial steps.

✖ deploy.worker        → Failed processing Deploy type=container name=worker (took 6.25 sec). Here is the output:

────────────────────────────────────────────────────────────────────────────────
Error deploying deploy.worker: ImagePullBackOff - Back-off pulling image "worker:v-5c1154e6d7"

━━━ Events ━━━
Deployment worker: ScalingReplicaSet - Scaled up replica set worker-88947db95 to 1
Pod worker-88947db95-gxr88: Scheduled - Successfully assigned vote-demo-quickstart-tao/worker-88947db95-gxr88 to k3d-k3s-default-server-0
Pod worker-88947db95-gxr88: Pulling - Pulling image "worker:v-5c1154e6d7"
Pod worker-88947db95-gxr88: Failed - Failed to pull image "worker:v-5c1154e6d7": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/worker:v-5c1154e6d7": failed to resolve reference "docker.io/library/worker:v-5c1154e6d7": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Pod worker-88947db95-gxr88: Failed - Error: ErrImagePull
Pod worker-88947db95-gxr88: BackOff - Back-off pulling image "worker:v-5c1154e6d7"
Pod worker-88947db95-gxr88: Failed - Error: ImagePullBackOff


━━━ Pod logs ━━━
<Showing last 30 lines per pod in this Deployment. Run the following command for complete logs>
$ kubectl -n vote-demo-quickstart-tao --context=k3d-k3s-default logs deployment/worker

****** worker-88947db95-gxr88 ******
------ worker ------<no logs>
────────────────────────────────────────────────────────────────────────────────
✖ deploy.api           → Failed (took 4.7 sec)
✖ deploy.api           → Failed processing Deploy type=container name=api (took 5.32 sec). Here is the output:

────────────────────────────────────────────────────────────────────────────────
Error deploying deploy.api: ImagePullBackOff - Back-off pulling image "api-build:v-6d254cdf3a"

━━━ Events ━━━
Deployment api: ScalingReplicaSet - Scaled up replica set api-64dcc9dc6f to 1
Pod api-64dcc9dc6f-2tf7s: Scheduled - Successfully assigned vote-demo-quickstart-tao/api-64dcc9dc6f-2tf7s to k3d-k3s-default-server-0
Pod api-64dcc9dc6f-2tf7s: Pulling - Pulling image "api-build:v-6d254cdf3a"
Pod api-64dcc9dc6f-2tf7s: Failed - Failed to pull image "api-build:v-6d254cdf3a": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/api-build:v-6d254cdf3a": failed to resolve reference "docker.io/library/api-build:v-6d254cdf3a": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Pod api-64dcc9dc6f-2tf7s: Failed - Error: ErrImagePull
Pod api-64dcc9dc6f-2tf7s: Failed - Error: ImagePullBackOff
Pod api-64dcc9dc6f-2tf7s: BackOff - Back-off pulling image "api-build:v-6d254cdf3a"


━━━ Pod logs ━━━
<Showing last 30 lines per pod in this Deployment. Run the following command for complete logs>
$ kubectl -n vote-demo-quickstart-tao --context=k3d-k3s-default logs deployment/api

****** api-64dcc9dc6f-2tf7s ******
------ api ------<no logs>
────────────────────────────────────────────────────────────────────────────────
✖ deploy.result        → Failed (took 4.7 sec)
✖ deploy.result        → Failed processing Deploy type=container name=result (took 5.41 sec). Here is the output:

────────────────────────────────────────────────────────────────────────────────
Error deploying deploy.result: ImagePullBackOff - Back-off pulling image "result:v-ac4c0a14af"

━━━ Events ━━━
Deployment result: ScalingReplicaSet - Scaled up replica set result-6549675586 to 1
Pod result-6549675586-c87f5: Scheduled - Successfully assigned vote-demo-quickstart-tao/result-6549675586-c87f5 to k3d-k3s-default-server-0
Pod result-6549675586-c87f5: Pulling - Pulling image "result:v-ac4c0a14af"
Pod result-6549675586-c87f5: Failed - Failed to pull image "result:v-ac4c0a14af": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/result:v-ac4c0a14af": failed to resolve reference "docker.io/library/result:v-ac4c0a14af": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Pod result-6549675586-c87f5: Failed - Error: ErrImagePull
Pod result-6549675586-c87f5: Failed - Error: ImagePullBackOff
Pod result-6549675586-c87f5: BackOff - Back-off pulling image "result:v-ac4c0a14af"


━━━ Pod logs ━━━
<Showing last 30 lines per pod in this Deployment. Run the following command for complete logs>
$ kubectl -n vote-demo-quickstart-tao --context=k3d-k3s-default logs deployment/result

****** result-6549675586-c87f5 ******
------ result ------<no logs>
────────────────────────────────────────────────────────────────────────────────
5 deploy action(s) failed!

@worldofgeese worldofgeese requested review from mkhq and ShankyJS May 25, 2023 11:45
@worldofgeese worldofgeese marked this pull request as ready for review May 25, 2023 12:01
@worldofgeese
Copy link
Contributor Author

worldofgeese commented May 25, 2023

I've figured this out. K3d uses its own registry and conveniently disregards the local registry Garden pushes images to.

For a solution, see comment.

I'm trying out k3s (so k3d minus the docker) to see about using k3s directly, which supports the --docker flag for using the local Docker registry. Maybe of interest to @jalper?

@worldofgeese
Copy link
Contributor Author

worldofgeese commented May 25, 2023

@twelvemo, @mkhq , @10ko it works! 🎉

The nodePort and linkUrl rewrite work!

One issue I encountered was the postgres deploy failing and not re-trying (this happened again on a brand new Cloud Shell and I don't know why):

image

I just ran deploy again, which successfully deployed all services the second time:

image

We didn't need a Cloudflare Tunnel, Inlets, etc. because Cloud Shell rewrites localhost links:

image

@worldofgeese worldofgeese requested review from 10ko and twelvemo May 25, 2023 15:51
@twelvemo
Copy link
Contributor

Oh that's so nice that cloud shell rewrites the links!


# Copy k3s config to user's home directory
mkdir -p ~/.kube
sleep 5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed to allow k3s time to generate the kubeconfig.

@twelvemo
Copy link
Contributor

@worldofgeese should we create a separate garden environment for cloud shell or do you want it to be the local environment?

start.sh Show resolved Hide resolved
@worldofgeese
Copy link
Contributor Author

worldofgeese commented May 25, 2023

@worldofgeese should we create a separate garden environment for cloud shell or do you want it to be the local environment?

@twelvemo I think local env is fine unless you think it's a good idea to have a separate one?

@worldofgeese worldofgeese force-pushed the feature/ce-33/cloudshell-quickstart branch from d0e6dd3 to 6502987 Compare May 26, 2023 14:27
@worldofgeese
Copy link
Contributor Author

@mkhq added button with shortlink to original post.

start.sh Show resolved Hide resolved
Copy link
Member

@10ko 10ko left a comment

Choose a reason for hiding this comment

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

This looks great! Well done!

I only have a question and I found a small rendering bug:

Screenshot 2023-05-30 at 18 32 22

deploy
```

If you receive an error like the following, wait until the `deploy` has finished, then try again:
Copy link
Member

Choose a reason for hiding this comment

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

Why are we getting this error in the first place? 🤔

Copy link
Contributor Author

@worldofgeese worldofgeese May 31, 2023

Choose a reason for hiding this comment

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

@10ko I have an issue opened here both @ShankyJS and I are running into. I've asked devs to take a look 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rendering bug has been fixed!

@worldofgeese worldofgeese requested a review from 10ko May 31, 2023 08:46
Copy link
Member

@10ko 10ko left a comment

Choose a reason for hiding this comment

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

LGTM

@worldofgeese worldofgeese merged commit 0f3c71b into main May 31, 2023
@worldofgeese worldofgeese deleted the feature/ce-33/cloudshell-quickstart branch May 31, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants