Skip to content

Instantly share code, notes, and snippets.

@pedes
Last active October 8, 2024 15:01
Show Gist options
  • Save pedes/465141d75508eb2f3dd167ce84e679bd to your computer and use it in GitHub Desktop.
Save pedes/465141d75508eb2f3dd167ce84e679bd to your computer and use it in GitHub Desktop.

Kubernetes Commands Cheat Sheet (Runtime Fabric MuleSoft version)

This unofficial gist contains a list of commands typically ran for Kubernetes and Runtime Fabric MuleSoft.

Tools | Prerequisites

1. Install & Configure Java 8

2. Install & Configure Maven

At the moment of writing this guide, the current maven version 3.9.0 it's not supported. (downgrade previous version)

3. Install AWS IAM Authenticator & AWS CLI (BOTH)

Both CLIs are required.

4. Install KUBECTL

Foundational Commands | Getting Started

  • Check the AWS User

aws --version (good checking the version of AWS CLI and AWS IAM Authenticator)

aws-iam-authenticator version

aws sts get-caller-identity

  • Check the connectivity with the Kubernetes Cluster

kubectl version --client (There's a know bug from the kubectl if version is higher than 1.23.14)

kubectl cluster-info

kubectl get --raw='/healthz?verbose'

rtfctl validate VALIDATIONDATA

rtfctl install VALIDATIONDATA

Verify the installation is correct by running

kubectl get pods -n rtf

kubectl get services

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.100.0.1 443/TCP 47m
  • Install License

rtfctl apply mule-license '2+W35iUhD9mRa1RQ5yxMSg99bjtQ7lERTjkAhtYNmbmnUBLui7iWk51KZQgbmhglKF9KevKV1fb4q7utJWU0c3FguWRykowE2Wu91UD7io6vXqafcAipvXvr26WhH6+HM6oRBzc71vqio6n01nOSnTswqwtq5hAeKkNLlz4ltLxN/ukhWArMNU57b/U3TWcFGE/ZfbnCpYbXX0wTnWZCu+0B1v3Nor44tQXgLy2n1FIlJTHmzd1fg0OESQaF8zqRBrBjjYau/MIRrz69cZCInFcBuMdVntNf2MDWqUJe1IXtAR8mgOyqhIBsRXrtEme0wanQf52ID8MwBFRalcc9CliZHsr0/eP7QuLU9EUNIfVzX0A5+he7nJNFfdbgULSLjsS9NH71gDp1x+bFGC3LSmOG0qNf5E/dJBo1RXHQPKJi05cBHCSINIIKKeNIMx3q7qZCCTwcsTVkO0K19Ex58AJh5mitxXgSxbPtmC7dgcI7ldOmo2nkj5h4wOtytCd2zi5E5BEMexqICe/Y9+QCnIAwyoVnHUKDtFUGqlPnNqhKH5b43sYrK5EPenoYSfdCAPa4vO4YpHsICDiGziXJaHZ7+3RXS950hu8Od8DDDQFUoh6I9gHA5/ILlZzTgeRRrW/iz8SFCdOBJVyINWeC+L4DO5v6ie3j36bTjVlZm7N01Y0Ngl2UF51Ybi4rXv+MuduP8qFZNJMnKzpHmAIouZt+uI1626gnH5NggyPDDMSayQcEaQFqwOlbxAcyeM++F8wL5UJNNASGFH8jo5qltGYnkPAnxnOtTPdsBJK99cDmeYml0PnQNrqFKYDsVYBvnPImlfEQo3o='

Cluster Management Commands (Change the name of the pod by the respective one)

Get all running pods in ALL namespaces

kubectl get pods -A --field-selector=status.phase=Running

Installation logs

kubectl logs rtf-install-job-ljpdz -n rtf > install.log

Get Events (audit your cluster)

kubectl get events -A > events.log

  • Get extra information about your pods

kubectl get pods -A -o yaml

kubectl get pods -A -o json

kubectl get pods -A -o wide

Restart the RTF Agent Pod

kubectl delete pods -n rtf -lapp=agent

Enable Log4J Custom Appenders from Mule Apps

kubectl -nrtf patch secret custom-properties -p '{"data":{"CUSTOM_LOG4J_ENABLED":"dHJ1ZQ=="}}'

See the secret content in plain text

kubectl get secret custom-properties -n rtf -o json | jq -r '.data | map_values(@base64d)'

Deployment to RTF

More details at Deploy RTF-app via API

Monitoring and vCore/Cores/vCPU Consumption

Change the namespace value by the one where the mule apps are running.

JSON Output with the CPU Limits assigned to each app container

kubectl get pods -n ed890e53-f35f-4ff8-9c96-91f95dcc82e4 -o json | jq '.items[] | {name: .metadata.name, containers: [.spec.containers[] | select(.name == "app") | {name: .name, cpuLimits: .resources.limits.cpu}]}'

References

Kubernetes Plugins and Libraries

@pedes
Copy link
Author

pedes commented Feb 26, 2024

kubectl logs mule-info-86b8f77d95-mv6tl -n 82bcfacc-14f6-437f-abe3-069d0a25bee2 -c app
Check license applied to mule container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment