Stupid Kubectl Tricks Jordan Liggitt, Red Hat

Similar documents
Code: Slides:

Question: 2 Kubernetes changed the name of cluster members to "Nodes." What were they called before that? Choose the correct answer:

DEVELOPER INTRO

Kubernetes objects on Microsoft Azure

Note: Currently (December 3, 2017), the new managed Kubernetes service on Azure (AKS) does not yet support Windows agents.

Kubernetes, CNCF and Beyond

/ Cloud Computing. Recitation 5 February 14th, 2017

Deployment Strategies on Kubernetes. By Etienne Tremel Software engineer at Container February 13th, 2017

RAFT library for Java

/ Cloud Computing. Recitation 5 September 26 th, 2017

Evolution of Kubernetes in One Year From Technical View

Introduction to Kubernetes

Managing Compute and Storage at Scale with Kubernetes. Dan Paik / Google

Kubernetes Basics. Christoph Stoettner Meetup Docker Mannheim #kubernetes101

Life of a Packet. KubeCon Europe Michael Rubin TL/TLM in GKE/Kubernetes github.com/matchstick. logo. Google Cloud Platform

Kubernetes 1.8 and Beyond

Kubernetes. Introduction

Infoblox IPAM Driver for Kubernetes User's Guide

Infoblox IPAM Driver for Kubernetes. Page 1

CHALLENGES IN A MICROSERVICES AGE: MONITORING, LOGGING AND TRACING ON OPENSHIFT. Martin Etmajer Technology May 4, 2017

Data Transfer on a Container. Nadya Williams University of California San Diego

Kubernetes - Load Balancing For Virtual Machines (Pods)

gcp / gke / k8s microservices

Kubernetes 1.9 Features and Future

What s New in Kubernetes 1.12

Creating a Multi-Container Pod

An Introduction to Kubernetes

ASP.NET Core & Docker

Services and Networking

Kubernetes made easy with Docker EE. Patrick van der Bleek Sr. Solutions Engineer NEMEA

OpenShift Dedicated 3 Release Notes

Implementing SaaS on Kubernetes

Kubernetes Integration Guide

Hacking and Hardening Kubernetes

Internals of Docking Storage with Kubernetes Workloads

Using Custom Resources to Provide Cloud Native API Management Frank B Greco Jr, Cloud Native Engineer, Northwestern Mutual

Convergence of VM and containers orchestration using KubeVirt. Chunfu Wen

Introduction to Kubernetes Storage Primitives for Stateful Workloads

Deploying PXC in Kubernetes / Openshift. Alexander Rubin, Percona

Bitnami s Kubernetes Projects Leverage Application delivery on Next Generation Platforms

10 Kube Commandments

Kubernetes on Openstack

Kubernetes: Twelve KeyFeatures

Ray Tsang Developer Advocate Google Cloud Platform

Docker Enterprise Edition 2.0 Platform Public Beta Install and Exercises Guide

Kubernetes, Persistent Volumes and the Pure Service Orchestrator. Simon Dodsley, Director of New Stack Technologies

Stackube Documentation

McAfee Cloud Workload Security Installation Guide. (McAfee epolicy Orchestrator)

Raw Block Volume in Kubernetes Mitsuhiro Tanino, Principal Software Engineer, Hitachi Vantara

INTRODUCING CONTAINER-NATIVE VIRTUALIZATION


Oracle Container Services for use with Kubernetes. User's Guide

Taming Distributed Pets with Kubernetes

Developing Kubernetes Services

Container Orchestration with Kubernetes on SUSE Linux

Using PCF Ops Manager to Deploy Hyperledger Fabric

Kuber-what?! Learn about Kubernetes

RDO container registry Documentation

PRP Distributed Kubernetes Cluster

The missing CI/CD Kubernetes component: Helm package manager

A REFERENCE ARCHITECTURE FOR DEPLOYING WSO2 MIDDLEWARE ON KUBERNETES

OpenShift Roadmap Enterprise Kubernetes for Developers. Clayton Coleman, Architect, OpenShift

RUNNING VIRTUAL MACHINES ON KUBERNETES. Roman Mohr & Fabian Deutsch, Red Hat, KVM Forum, 2017

Red Hat Enterprise Linux Atomic Host 7 Getting Started with Kubernetes

Kubernetes Storage: Current Capabilities and Future Opportunities. September 25, 2018 Saad Ali & Nikhil Kasinadhuni Google

What s New in K8s 1.3

KUBERNETES IN A GROWN ENVIRONMENT AND INTEGRATION INTO CONTINUOUS DELIVERY

Kubernetes Autoscaling on Azure. Pengfei Ni Microsoft Azure

NSX-T Container Plug-in for Kubernetes and Cloud Foundry - Installation and Administration Guide

What s New in K8s 1.3

Federated Prometheus Monitoring at Scale

Secure Kubernetes Container Workloads

OpenShift Container Platform 3.11

OpenShift Cheat Sheet

OPENSHIFT 3.7 and beyond

Bright Cluster Manager: Using the NVIDIA NGC Deep Learning Containers

Implementing Container Application Platforms with Cisco ACI

CONTINUOUS INTEGRATION CONTINUOUS DELIVERY

Using Eclipse Che IDE to develop your codebase. Red Hat Developers Documentation Team :15:48 UTC

Detecting Cryptojacking on Openshift with Sysdig Falco. Mark Stemm - Falco Engineer

Disclaimer This presentation may contain product features that are currently under development. This overview of new technology represents no commitme

Authorized Source IP for OpenShift Project

Fault Tolerant Stateful Services on Kubernetes. Timothy St.

Operating Within Normal Parameters: Monitoring Kubernetes

Wolfram Richter Red Hat. OpenShift Container Netzwerk aus Sicht der Workload

Disclaimer This presentation may contain product features that are currently under development. This overview of new technology represents no commitme

HLF K8S A hitchhiker s guide to deploying Hyperledger Fabric on Kubernetes

Continuous delivery while migrating to Kubernetes

Node Feature Discovery

Compliments of FREE CHAPTERS. Kubernetes. Up & Running DIVE INTO THE FUTURE OF INFRASTRUCTURE. Kelsey Hightower, Brendan Burns & Joe Beda

NSX-T Container Plug-in for Kubernetes and Cloud Foundry - Installation and Administration Guide

SAMPLE CHAPTER. Marko Lukša MANNING

Table of Contents. Section 1: Overview 3 NetScaler Summary 3 NetScaler CPX Overview 3

Declarative Modeling for Cloud Deployments

Important DevOps Technologies (3+2+3days) for Deployment

The Path to GPU as a Service in Kubernetes Renaud Gaubert Lead Kubernetes Engineer

CONTAINERS AND MICROSERVICES WITH CONTRAIL

Installation Guide for Kony Fabric Containers Solution On-Premises

OpenShift Container Platform 3.11 CLI Reference

Managing and Protecting Persistent Volumes for Kubernetes. Xing Yang, Huawei and Jay Bryant, Lenovo

Transcription:

Stupid Kubectl Tricks Jordan Liggitt, Red Hat

1. Personality Test

1. Personality Test kubectl

1. Personality Test kube con trol engineer control freak kube control to Major Tom

1. Personality Test kube cut tle scary operations expert 8 arms. 2 tentacles. 0 pets.

1. Personality Test kube ee cud dle open-source hippie live. love. linux.

1. Personality Test <anything else> special snowflake just like everyone else

2. Autocomplete $ source <(kubectl completion bash)

2. Autocomplete $ kubectl alpha cluster-info describe annotate completion drain api-versions config edit apply convert exec attach cordon explain

2. Autocomplete $ kubectl get certificatesigningrequest ingress configmap networkpolicy cronjob persistentvolume daemonset persistentvolumeclaim endpoints poddisruptionbudget horizontalpodautoscaler podtemplate

2. Autocomplete $ kubectl get horizontalpodautoscaler -- --all-namespaces --allow-missing-template-keys --alsologtostderr --as-group= --as=

3. Trace logging $ kubectl get pods --all-namespaces GET /api/v1/pods

3. Trace logging $ kubectl run pi --schedule="0/5 * * *?" \ --image=perl --restart=onfailure \ -- perl -Mbignum=bpi -wle 'print bpi(2000)'

3. Trace logging -v

3. Trace logging $ kubectl run -v=6 pi --schedule="0/5 * * *?" \ --image=perl --restart=onfailure \ -- perl -Mbignum=bpi -wle 'print bpi(2000)' POST /apis/batch/v1beta1/namespaces/default/cronjobs

3. Trace logging $ kubectl run -v=7 pi --schedule="0/5 * * *?" \ --image=perl --restart=onfailure \ -- perl -Mbignum=bpi -wle 'print bpi(2000)' Request Headers: User-Agent: kubectl/v1.9.0 (darwin/amd64) Accept: application/json, */* Content-Type: application/json

3. Trace logging $ kubectl run -v=8 pi --schedule="0/5 * * *?" \ --image=perl --restart=onfailure \ -- perl -Mbignum=bpi -wle 'print bpi(2000)' Request Body: {"kind":"cronjob","apiversion":"batch/ v1beta1","metadata":{"name":"pi", Response Body: {"kind":"cronjob","apiversion":"batch/ v1beta1","metadata":{"name":"pi",

3. Trace logging $ kubectl run -v=9 pi --schedule="0/5 * * *?" \ --image=perl --restart=onfailure \ -- perl -Mbignum=bpi -wle 'print bpi(2000)' curl -k -v -XPOST -H "Accept: application/json, */*" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.9.0 (darwin/amd64) kubernetes/94645c4" https://localhost:6443/apis/batch/v1beta1/namespaces/ default/cronjobs

3. Trace logging

4. Qualified Resources $ kubectl get deployments/mydep -o yaml kind: Deployment apiversion: \_( ツ )_/ metadata: name: mydep

4. Qualified Resources $ kubectl get <resource> $ kubectl get <resource>.<group> $ kubectl get <resource>.<version>.<group>

4. Qualified Resources $ kubectl get deployments $ kubectl get deployments.apps $ kubectl get deployments.v1.apps

5. Conversion apiversion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: apache spec: scaletargetref: apiversion: apps/v1 kind: Deployment name: apache minreplicas: 1 maxreplicas: 10 targetcpuutilizationpercentage: 50

5. Conversion $ sed s#autoscaling/v1#autoscaling/v2beta1#

5. Conversion

5. Conversion apiversion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: apache spec: scaletargetref: apiversion: apps/v1 kind: Deployment name: apache minreplicas: 1 maxreplicas: 10 targetcpuutilizationpercentage: 50 apiversion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: apache spec: scaletargetref: apiversion: apps/v1 kind: Deployment name: apache minreplicas: 1 maxreplicas: 10 metrics: - type: Resource resource: name: cpu targetaverageutilization: 50

5. Conversion $ kubectl convert --output-version=autoscaling/v2beta1

6. Explain $ kubectl explain <resource> --recursive

6. Explain $ kubectl explain hpa --recursive DESCRIPTION: configuration of a horizontal pod autoscaler. FIELDS: spec <Object> maxreplicas <integer> minreplicas <integer> scaletargetref <Object>

6. Explain $ kubectl explain hpa --recursive \ --api-version=autoscaling/v2beta1 DESCRIPTION: specification of a horizontal pod autoscaler. FIELDS: spec <Object> maxreplicas <integer> minreplicas <integer> metrics <[]Object>

6. Explain $ kubectl explain life the server doesn't have a resource type "life"

7. Piping $ cat greeting Happy Thanksgiving! $ kubectl create configmap greeting --from-file=greeting configmap "greeting" created

7. Piping $ cat greeting Merry Christmas! $ kubectl create configmap greeting --from-file=greeting Error from server: configmaps "greeting" already exists

7. Piping $ kubectl create configmap greeting \ --from-file=greeting --dry-run --output json { "kind": "ConfigMap", "apiversion": "v1", "metadata": {"name": "greeting"}, "data": {"greeting": " Merry Christmas!"} }

7. Piping $ kubectl create configmap greeting \ --from-file=greeting --dry-run --output json \ kubectl apply -f - configmap "greeting" configured

8. Portable Kubeconfig $ kubectl config view apiversion: v1 clusters: - cluster: certificate-authority: certificate-authority.crt server: https://stage.acme.com:6443

8. Portable Kubeconfig $ kubectl config view --flatten > portable.kubeconfig apiversion: v1 clusters: - cluster: certificate-authority-data: LS0tLS1CRUdJTiBDRVJU server: https://stage.acme.com:6443

9. Current Context $ kubectl config view --minify \ --output 'jsonpath={..server} {..namespace}' https://prod.acme.com:6443 mynamespace

9. Current Context $ PS1="[\$( kubectl config view --minify \ --output 'jsonpath={..server} {..namespace}' )]\$ " [https://prod.acme.com:6443 mynamespace]$

Stupid Kubectl Tricks Jordan Liggitt, Red Hat http://bit.ly/stupid-kubectl-tricks