- Navigate to
Cluster Management
page on Rancher - Find the
Machine Pool
section of the cluster - Right-click to access the
Download SSH Key
option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Port-Forward To RKE2 Prometheus In Harvester | |
Retrieve the `web.external-url` from the Prometheus pod: | |
```sh | |
k -n cattle-monitoring-system get po prometheus-rancher-monitoring-prometheus-0 -ojsonpath='{.spec.containers[?(@.name=="prometheus")].args}' | grep "web.ext | |
ernal-url" | |
``` |
Changing RKE2 etcd storage size:
echo 'etcd-arg: "quota-backend-bytes=4294967296"' > /etc/rancher/rke2/config.yaml.d/etcd.yaml
The rke2 server --cluster-reset
command can be used to reset etcd to a single-node cluster, with its data intact.
See https://docs.rke2.io/datastore/backup_restore
Stop the RKE2 server:
sudo systemctl stop rke2-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
annotations: | |
name: vnodes.virt.dev | |
spec: | |
group: virt.dev | |
names: | |
kind: VNode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cel | |
const ( | |
// PerCallLimit specify the actual cost limit per CEL validation call | |
// current PerCallLimit gives roughly 0.1 second for each expression validation call | |
PerCallLimit = 1000000 | |
// RuntimeCELCostBudget is the overall cost budget for runtime CEL validation cost per ValidatingAdmissionPolicyBinding or CustomResource | |
// current RuntimeCELCostBudget gives roughly 1 seconds for the validation | |
RuntimeCELCostBudget = 10000000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Evaluate runs a compiled CEL admission plugin expression using the provided activation and CEL | |
// runtime cost budget. | |
func (a *evaluationActivation) Evaluate(ctx context.Context, compositionCtx CompositionContext, compilationResult CompilationResult, remainingBudget int64) (EvaluationResult, int64, error) { | |
// ... | |
t1 := time.Now() | |
evalResult, evalDetails, err := compilationResult.Program.ContextEval(ctx, a) | |
// budget may be spent due to lazy evaluation of composited variables | |
if compositionCtx != nil { | |
compositionCost := compositionCtx.GetAndResetCost() | |
if compositionCost > remainingBudget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ForInput evaluates the compiled CEL expressions converting them into CELEvaluations | |
// errors per evaluation are returned on the Evaluation object | |
// runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. | |
func (c *condition) ForInput(ctx context.Context, versionedAttr *admission.VersionedAttributes, request *admissionv1.AdmissionRequest, inputs OptionalVariableBindings, namespace *v1.Namespace, runtimeCELCostBudget int64) ([]EvaluationResult, int64, error) { | |
// ... | |
remainingBudget := runtimeCELCostBudget | |
for i, compilationResult := range c.compilationResults { | |
evaluations[i], remainingBudget, err = activation.Evaluate(ctx, compositionCtx, compilationResult, remainingBudget) | |
if err != nil { | |
return nil, -1, err |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (v *validator) Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.Authorizer) ValidateResult { | |
// ... | |
evalResults, remainingBudget, err := v.validationFilter.ForInput(ctx, versionedAttr, admissionRequest, optionalVars, ns, runtimeCELCostBudget) | |
if err != nil { | |
return ValidateResult{ | |
Decisions: []PolicyDecision{ | |
{ | |
Action: policyDecisionActionForError(f), | |
Evaluation: EvalError, | |
Message: err.Error(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dispatch implements generic.Dispatcher. | |
func (c *dispatcher) Dispatch(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces, hooks []PolicyHook) error { | |
// ... | |
validationResults = append(validationResults, | |
hook.Evaluator.Validate( | |
ctx, | |
matchResource, | |
versionedAttr, | |
p, | |
namespace, |
NewerOlder