Getting Started With Rancher Cheatsheetw - Java136
Getting Started With Rancher Cheatsheetw - Java136
RANCHER
Preface 1
Introduction 1
RKE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
K3s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Setting up Rancher 3
Installing Rancher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Adding a Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Managing Clusters 4
Creating a RKE Cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Rancher on a K3s cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Working with Environments 7
Creating Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Switching Between Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Deploying Applications 7
Deploying Using Catalog Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Deploying Using Kubernetes Manifests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Monitoring and Scaling 7
Monitoring Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Scaling Workloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
ETCD Backups 7
Access the Master Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Identify etcd Data Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Stop K3s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Create the Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Start K3s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Test the Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Additional Resources 8
PREFACE
PREFACE Scalability is a key consideration for modern
applications, and Rancher facilitates this by
This cheatsheet is organized to guide you through managing infrastructure resources and load
key aspects of Rancher, from installation and setup balancing traffic. This ensures that applications can
to creating clusters, deploying applications, and handle increased workloads without compromising
maintaining a healthy container ecosystem. Each performance.
section provides clear instructions, command
snippets, and explanations that will help you grasp Networking capabilities are also integral to
the core concepts and master the essential tasks. Rancher’s offering. It allows users to manage
communication between containers and services
INTRODUCTION
INTRODUCTION
effectively. This includes support for overlay
networks, which simplify complex network
Getting started, Rancher is an open-source platform topologies.
with its design to simplify container management
Security is a paramount concern in container
within Kubernetes environments. It provides a
environments, and Rancher addresses this through
comprehensive suite of tools and features that
features like integration with external
streamline the deployment, orchestration, and
authentication systems and encryption for data at
scaling of containers, making it an ideal solution for
rest. These security measures enhance the overall
DevOps teams, system administrators, and
robustness of the platform.
developers.
One of Rancher’s standout features is its robust Rancher Kubernetes Engine (RKE) is a powerful
user authentication and access control system. This open-source tool provided by Rancher Labs that
ensures secure access to the platform and its simplifies the process of deploying, managing, and
resources, essential for maintaining the integrity of maintaining Kubernetes clusters. RKE enables users
your containerized applications. to create production-ready Kubernetes clusters
with a user-friendly approach and a focus on
Rancher comes equipped with an application security, flexibility, and ease of use.
catalog that contains a library of pre-defined
application templates. These templates simplify the Feature Description
deployment process for complex applications,
Cluster Deployment RKE automates the
enabling users to launch them with minimal
provisioning and
configuration. Additionally, Rancher supports
configuration of
infrastructure provisioning, allowing users to set up
infrastructure and
the underlying infrastructure for their clusters
Kubernetes components
through integrations with different cloud providers.
for clusters. It’s valuable
for setting up clusters on
Monitoring and logging are crucial aspects of
various infrastructure
container management, and Rancher addresses this
providers and on-
with seamless integration with popular tools like
premises environments.
Prometheus and Grafana. This integration provides
valuable insights into application performance,
enabling proactive management and issue
resolution.
Install Docker if it’s not already installed: Before creating a cluster, you need to install the
RKE tool. You can download RKE from the official
GitHub repository or use a package manager like
sudo apt update brew for macOS or apt for Linux.
sudo apt install docker.io
For example, to install RKE on Linux using curl:
Once you have the cluster configuration, deploy the Deploying Rancher on a K3s cluster allows you to
Kubernetes cluster using the following command: manage and orchestrate Kubernetes clusters
through Rancher’s user-friendly interface. Rancher
simplifies the management of clusters, applications,
rke up --config cluster.yaml and infrastructure, making it an excellent choice
for centralizing Kubernetes operations. Here’s how
you can deploy Rancher on a K3s cluster:
This command will provision the cluster’s
infrastructure, install Kubernetes components, and
set up the cluster according to your configuration. Creating a K3s cluster
Using K3s
Access Rancher UI
You can now use kubectl commands to manage
After the installation is complete, you can access the
your K3s cluster, just like with any other
Rancher UI using the domain name or IP address
Kubernetes cluster.
you provided. Open your web browser and
navigate to https://rancher.example.com (use the
Install Rancher domain you configured).
for your K3s cluster (usually located at • Click "Launch" and follow the prompts to
~/.kube/config). Rancher will use this configuration configure the application.
to connect to your K3s cluster.
DEPLOYING USING KUBERNETES
Access Managed Clusters MANIFESTS
Once you’ve added the K3s cluster to Rancher, you If you have custom Kubernetes manifests, you can
can manage it through the Rancher UI. This deploy them in Rancher:
includes deploying applications, managing
workloads, monitoring, and more. • In the Rancher dashboard, navigate to the
desired cluster and environment.
WORKINGWITH
WORKING WITHENVIRONMENTS
ENVIRONMENTS
• Click on "Workloads" in the main menu.
• Click "Deploy."
CREATING ENVIRONMENTS
• Choose "Deploy YAML" and paste your
Environments in Rancher allow you to logically Kubernetes manifest.
organize your applications and services. To create
• Click "Continue" and adjust any settings as
an environment:
needed before deploying.
• Provide a name and description for the Rancher provides monitoring capabilities through
environment. integration with tools like Prometheus and Grafana.
To set up monitoring:
• Click "Create."
DEPLOYINGAPPLICATIONS
DEPLOYING APPLICATIONS • In the Rancher dashboard, go to the cluster and
environment containing the workload.
• Browse available templates, select the desired Backing up etcd is crucial for maintaining the
one, and click "View Details." integrity and recoverability of your Kubernetes
cluster’s state. etcd is the distributed key-value environment to restore the etcd backup and verify
store that stores all the configuration data and the cluster’s functionality.
metadata for your cluster. In Rancher, etcd backups
are essential for disaster recovery scenarios. Here’s ADDITIONALRESOURCES
ADDITIONAL RESOURCES
how you can perform etcd backups in a Rancher-
managed Kubernetes cluster:
Resource Description
Resource Description
JCG delivers over 1 million pages each month to more than 700K software
developers, architects and decision makers. JCG offers something for everyone,
including news, tutorials, cheat sheets, research guides, feature articles, source code
and more.
CHEATSHEET FEEDBACK
WELCOME
support@javacodegeeks.com
Copyright © 2014 Exelixis Media P.C. All rights reserved. No part of this publication may be SPONSORSHIP
reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, OPPORTUNITIES
mechanical, photocopying, or otherwise, without prior written permission of the publisher. sales@javacodegeeks.com