Giter VIP home page Giter VIP logo

azure-kube-cli's Introduction

Azure CLI Extension for ACS/AKS Infrastructure Operations

Python

This CLI extension allows for various general purpose operations for Kubernetes clusters running on Azure.

Currently supports migration of Persistent Volumes and Data Disks between a source ACS (Azure Container Service) cluster and a target AKS (Managed Kubernetes) cluster as well as export the entire cluster state for backup/restore scenarios.

Features

The CLI extension will let you:

  • Take a snapshot of cluster state for back/restore purposes
  • Migrate Persistent Volumes resources from ACS to AKS
  • Migrate Persistent Volumes resources from AKS to AKS
  • Move Unmanaged Data Disks from ACS to AKS
  • Move Managed Data Disks from ACS to AKS
  • Migrate clusters between regions

Cluster Backup Features

The following platforms are supported for cluster backup functionality:

  • AKS
  • ACS
  • ACS-Engine
  • OpenShift
  • Tectonic

Installation

Step 0: Install/Update Azure CLI

Make sure you have the latest version of the Azure CLI installed.

If you don't have the Azure CLI intalled, follow the installation instructions on GitHub or Microsoft Docs to setup Azure CLI in your environment.

Step 1:

Navigate to this project's release tab in GitHub to see the list of releases. Run the extension add command using the --source parameter.

The argument for the source parameter is either the URL download path (the extension package ends with '.whl') of your chosen release, or the local path to the extension where you downloaded the release package.

az extension add --source <local file path to release.whl OR url for release.whl>

For example, to install version 0.0.1

az extension add --source 'https://github.com/yaron2/azure-kube-cli/releases/download/0.0.1/azure_kube_cli-0.0.1-py2.py3-none-any.whl'

Command-Line Usage

Group
    az kube

Commands:
    copy-volumes: Copy Persistent Volumes from ACS to AKS.
    copy-aks-volumes: Copy Persistent Volumes from AKS to AKS.
    export      : Export a Kubernetes cluster's resources to disk.

Usage Examples

migrate an ACS cluster to AKS

az kube copy-volumes --source-acs-name=myacs --target-aks-name=myaks --acs-resourcegroup=rg1 --aks-resourcegroup=rg2

migrate and use your own source and target kubeconfigs

az kube copy-volumes --source-kubeconfig=~/.source --target-kubeconfig=~/.target --source-acs-name=myacs --target-aks-name=myaks

migrate AKS cluster volumes to AKS

az kube copy-aks-volumes --source-aks-name test-kube-source --source-aks-resourcegroup test-kube-source --target-aks-name test-kube-target --target-aks-resourcegroup test-kube-target --source-kubeconfig source.config --target-kubeconfig target.config

Backups a cluster's state

az kube export --kubeconfig=./myconfig

Backups a cluster's state to a custom dir

az kube export --kubeconfig=./myconfig --output-dir=./backup

Restore or migrate a cluster's state

Once you have executed the kube export command, the cluster's configuation will be generated and will be exported to a configuration file named cluster.json in the directory executed where executed or in the custom directory path specified. Execute the kubectl apply command on the cluster.json to import the saved cluster configuration. Make sure your config has the correct cluster context you want to restore to.

kubectl apply -f cluster.json

Development

Extension development depends on a local Azure CLI dev environment. First, follow these instructions to prepare your machine.

Next, update your AZURE_EXTENSION_DIR environment variable to a target extension deployment directory. This overrides the standard extension directory.

Example export AZURE_EXTENSION_DIR=~/.azure/devcliextensions/

Run the following command to setup and install all dependencies in the extension deployment directory.

pip install -U --target <extension deployment directory>/azure_kube_cli_ext <kube extension code root>

Repeat the above command as needed.

At this point, assuming the setup is good the extension should be loaded and you should see the extension command space. Use az --debug and az extension list for debugging this step.

Helpful Reference docs for Az CLI Extension development

azure-kube-cli's People

Contributors

yaron2 avatar phillipgibson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.