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

Add K8S controller #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add K8S controller #22

wants to merge 2 commits into from

Conversation

ale8k
Copy link
Contributor

@ale8k ale8k commented Sep 28, 2023

A simple tutorial on adding k8s cloud to JIMM.

Copy link
Contributor

@kian99 kian99 left a comment

Choose a reason for hiding this comment

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

lgtm with some suggestions

@@ -0,0 +1,81 @@
JAAS: Add a K8S cloud to JIMM
Copy link
Contributor

Choose a reason for hiding this comment

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

A suggestion, how different is it adding a generic cloud versus a k8s cloud? Could we make this a guide for adding any kind of cloud and then include a ::note section example here, on what tweaks to make for a k8s cloud.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this should remain a very specific how-to.. other than k8s, i think users would only ever want to add maas as a cloud.. and that could be another tutorial

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mhmmm, idk here, happy to do whatever you guys conclude on

- Have JIMM deployed with admin access
- Have a machine based controller added to JIMM
- Basic knowledge of K8S
- A controller running in the region next to your K8S deployment, whether that be
Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing, in the region next to your k8s deployment. What does "next to" mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok I meant same subnet or a subnet with specific routing rules to another subnet, I'll update to be clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


``cat ~/.kube/config``

In this `contexts` object, locate your designed context and remember
Copy link
Contributor

Choose a reason for hiding this comment

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

designed -> desired?

Copy link
Collaborator

Choose a reason for hiding this comment

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

or "designated"

Copy link
Collaborator

Choose a reason for hiding this comment

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

although.. to be fair.. we never tell users how to organize their .kube/config file.. they might not have multiple contexts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is typical to have them in one config file as k8s doesnt support config file aggregation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 on desired, changed @kian99


Next we'll add the cloud by context to JIMM.

Firstly let us switch to the JIMM controller (note, this is not the controller JIMM is running on but JIMM itself), run:
Copy link
Contributor

Choose a reason for hiding this comment

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

Then maybe we should just say "switch to JIMM", keeping the bits in brackets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit lost with this, what do you mean?

how-to/add_k8s_cloud.rst Show resolved Hide resolved

JIMM will now take these credentials, and add them to the controller within that cloud and region.

You can check if the credential have been uploaded to the controller managed by JIMM via:
Copy link
Contributor

Choose a reason for hiding this comment

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

have -> has

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit confusing.. you're saying "if the credenital(s) have been uploaded" and in the next step you're telling users they need to update credentials.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes sorry, it should say "cloud" not credential, updated

As you're an admin, no access grants are required:
``juju add-credential <your k8s cloud name>``

This will take you through an interactive input terminal, typically all fields can be skipped
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to know what the other fields are for though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


This will take you through an interactive input terminal, typically all fields can be skipped
except one. When asked for what auth type you wish to use, select OAuth2.0 and retrieve your
access token and user for your cluster from `~/.kube/config`, this is located in the user section.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can users authenticate with a k8s cluster via username/password auth? Or other auth besides OAuth

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup they can! updated to include

@@ -0,0 +1,81 @@
JAAS: Add a K8S cloud to JIMM
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this should remain a very specific how-to.. other than k8s, i think users would only ever want to add maas as a cloud.. and that could be another tutorial


Introduction
------------
In this how-to, we will demonstrate adding a K8S cloud to JIMM
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick.. we are not "demonstrating" we are showing users how to do it..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


``cat ~/.kube/config``

In this `contexts` object, locate your designed context and remember
Copy link
Collaborator

Choose a reason for hiding this comment

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

or "designated"


``cat ~/.kube/config``

In this `contexts` object, locate your designed context and remember
Copy link
Collaborator

Choose a reason for hiding this comment

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

although.. to be fair.. we never tell users how to organize their .kube/config file.. they might not have multiple contexts

how-to/add_k8s_cloud.rst Show resolved Hide resolved
how-to/add_k8s_cloud.rst Show resolved Hide resolved
Add your K8S cloud using the following command:
``juju add-k8s --context-name <context field from ~/.kube/config> --cloud=<cloud name> --region=<region name> <your k8s cloud name>``

Presuming you are running on EKS, your command may look like:
Copy link
Collaborator

Choose a reason for hiding this comment

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

presuming your context name is "operatorinc" and the eks cluster is running in eu-west-2..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


JIMM will now take these credentials, and add them to the controller within that cloud and region.

You can check if the credential have been uploaded to the controller managed by JIMM via:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit confusing.. you're saying "if the credenital(s) have been uploaded" and in the next step you're telling users they need to update credentials.

On your JIMM instance where you are the administrator, run:
``juju grant-cloud <username> add-model <your k8s cloud name>``

Lastly, request the user runs the following on the JIMM controller:
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm.. should we show them how to create users in k8s.. i don't think we would want to advise them to share the same credential with all users that should have access to the new cloud.

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 can be really complicated as there's many ways to do it ... I feel this was more a "quick and dirty" how-to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants