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

Added instructions to update kubeconfig after manual certs renewal or cluster upgrade #7890

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

Conversation

saiteja313
Copy link

Issue #, if available:

Description of changes:

  • As a EKSA Cluster admin, I want to update kubeconfig file on Admin machine post renewing cluster certificates manually.

Testing (if applicable):

  • not tested.

Documentation added/planned (if applicable): This pull request is documentation update

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chrisnegus for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot
Copy link
Collaborator

Hi @saiteja313. Thanks for your PR.

I'm waiting for a aws member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eks-distro-bot eks-distro-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 23, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.46%. Comparing base (6c07643) to head (85ce68c).
Report is 20 commits behind head on main.

❗ Current head 85ce68c differs from pull request most recent head 8a212d7. Consider uploading reports for the commit 8a212d7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7890      +/-   ##
==========================================
+ Coverage   73.43%   73.46%   +0.03%     
==========================================
  Files         576      577       +1     
  Lines       35667    35744      +77     
==========================================
+ Hits        26191    26261      +70     
- Misses       7823     7826       +3     
- Partials     1653     1657       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


#### Update kubeconfig on Admin machine

Post completion of manual certificate rotation or if your Cluster was created more than a year ago, your kubeconfig file on Admin machine will have outdated certificates and would result in following error,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Post completion of manual certificate rotation or if your Cluster was created more than a year ago, your kubeconfig file on Admin machine will have outdated certificates and would result in following error,
Your local kubeconfig used to interact with the cluster contains a certificate that expires after 1 year. When you rotate cluster certificates a new kubeconfig with a new certificate is created as a Secret in the cluster. If you do not retrieve the new kubeconfig and your local kubeconfig certificate expires you will receive the following error:

@@ -168,3 +168,74 @@ ${IMAGE_ID} tmp-cert-renew \
5. Repeat the above steps for all control plane nodes.

You can similarly use the above steps to rotate a single certificate instead of all certificates.

#### Update kubeconfig on Admin machine
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#### Update kubeconfig on Admin machine
#### Update your kubeconfig

Admin machines are ephemeral. Suggesting they need to update the admin machine is a little misleading as it may no longer exist.

This error typically occurs when the cluster certificates have been renewed or extended during the upgrade process. To resolve this issue, you need to update your local kubeconfig file with the new cluster credentials.
```

Follow below steps to update kubeconfig on Admin machine.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Follow below steps to update kubeconfig on Admin machine.
You can extract your new kubeconfig using the following steps.


Follow below steps to update kubeconfig on Admin machine.

1. SSH to one of the Control Plane nodes and run the following command to validate connection with API Server, export kubeconfig from `${CLUSTER_NAME}-kubeconfig` secret object (`eksa-system` namespace) using kubectl and copy kubeconfig file to `/tmp` directory.
Copy link
Member

Choose a reason for hiding this comment

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

This step is only necessary if the local kubeconfig has already expired. If not, they should be able to retrieve the secret with the existing cert data.

Can we move the step to retrieve the admin.conf to a separate subheading "What do I do if my local kubeconfig has expired?"

Comment on lines +197 to +198
kubectl get nodes -o wide
kubectl get secrets -A
Copy link
Member

Choose a reason for hiding this comment

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

These steps aren't necessary so I think we can eliminate them.

Comment on lines +216 to +217
kubectl get nodes -o wide
kubectl get secrets -A
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

# open a root shell
sudo sheltie

export CLUSTER_NAME="<YOUR_CLUSTER_NAME_HERE>"
Copy link
Member

Choose a reason for hiding this comment

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

Unused.


kubectl get secret ${CLUSTER_NAME}-kubeconfig -n eksa-system -o yaml > new-admin.kubeconfig

cat new-admin.kubeconfig | base64 -d > /tmp/new-admin-decoded.kubeconfig
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't need to decode the admin.conf. Decoding is only needed for the secret we extract from the cluster.

Comment on lines +233 to +235
# OR SFTP

sftp -i <keypair>@${CONTROLPLANE_IP}:/tmp/new-admin-decoded.kubeconfig .
Copy link
Member

Choose a reason for hiding this comment

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

Why would scp not work? I think we can include a single approach (scp) and let the user decide how they want to do it (I can think of several other approaches and we don't want to enumerate them).

{{< /tabpane >}}


2. **SSH to Admin Machine**, download the kubeconfig file from ControlPlane to your Admin machine and access Kubernetes Cluster
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
2. **SSH to Admin Machine**, download the kubeconfig file from ControlPlane to your Admin machine and access Kubernetes Cluster
2. From your admin machine, download the kubeconfig file from the ControlPlane node and use it to access your Kubernetes Cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Documentation documentation needs-ok-to-test size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants