Giter Site home page Giter Site logo

containersolutions / kubernetes-examples Goto Github PK

View Code? Open in Web Editor NEW
1.4K 45.0 294.0 338 KB

Minimal self-contained examples of standard Kubernetes features and patterns in YAML

Home Page: https://k8s-examples.container-solutions.com/

License: MIT License

Makefile 10.67% Shell 89.33%
kubernetes yaml hacktoberfest

kubernetes-examples's Introduction

yamllint

Kubernetes Examples

A reference repository of YAML with canonical and as-simple-as-possible demonstrations of kubernetes functionality and features.

See here for a searchable front-end: https://k8s-examples.container-solutions.com/

Kubernetes Examples

Why?

At Container Solutions we find we regularly need chunks of YAML to demonstrate something specific, such as:

  • A simple deployment

  • A simple pod

  • A pod with a volume

This might be to do a basic test of an environment, find an example to tinker with, or send to someone to get them going.

Usage

The examples can be used by a kubectl plugin examples. This plugin can be installed by krew:

  • first install krew
  • Install a custom plugin index: kubectl krew index add cs https://github.com/ContainerSolutions/kubernetes-examples.git
  • Install this plugin: kubectl krew install cs/examples

Interactively discover by first selecting the resource type:

$ kubectl examples

filter by resource type

$ kubectl examples Service

filter by resource type and pattern

$ kubectl examples Pod res

If there is only a single match selected by the parameters, it is printed to the stdout. So you can deploy a modified version of a sample by:

$ export KUBE_EDITOR='code -w'
$ kubectl examples Ingress fanout | kubectl create -f - --edit

Sections

broken-* - yamls that exemplify broken kubernetes yaml states

[A-Z][a-zA-Z]* - Example yamls that correspond to resource types.

test - Scripts to test or validate the YAML

Within those folders are either simple/canonical examples, or examples in subfolders that expose particular items of functionality that are highlighted by their yaml path, eg Pod/spec.initContainers/.

If an example is an exemplar of a particular feature but tightly related to another resource, then an absolute folder might be added eg in Service there is Service/Pod.spec.subdomain.

Symlinks are also used to make finding things easier, eg Service/headless-service -> Service/spec.clusterIP.

plugins - a directory following the spec for a Custom krew plugin index

Principles

The examples seek to be:

  • As simple as possible to illustrate the functionality

  • Self-contained (ie limited to one .yaml file)

  • Non-conflicting (eg resource names are unique)

  • Clear (eg resource names are verbose and unambiguous)

Release Process

See here

Sources / Thanks To

Official Kubernetes docs

Kubernetes by Example

Practical Kubernetes

Security Examples

kubernetes-examples's People

Contributors

3t8 avatar actions-user avatar amouat avatar anoopmsivadas avatar chris-cmsoft avatar eliottha avatar eminalemdar avatar gt-sun avatar ianmiell avatar knelasevero avatar kolja-lucht avatar lalyos avatar melihc1 avatar sebagomez avatar shteou avatar ttarczynski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernetes-examples's Issues

Add PriorityClass Example

We're missing an example for PriorityClass.

It should be possible to use an example from the Kubernetes docs.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

Check and update all previous examples to the latest APIs

  • ClusterRole
  • ClusterRoleBinding
  • ConfigMap
  • CronJob
  • DaemonSet
  • Deployment
  • EndpointSlice
  • Ingress
  • Job
  • LimitRange
  • Namespace
  • NetworkPolicy
  • PersistentVolume
  • PersistentVolumeClaim
  • Pod
  • PodDisruptionBudget
  • PodSecurityPolicy
  • PriorityClass
  • ResourceQuotas
  • Role
  • RoleBinding
  • Secret
  • Service
  • ServiceAccount
  • StatefulSet
  • StorageClass
  • broken-Pod
  • broken-Secret
  • broken-Deployment

readiness probe

One with a nice readiness probe and one with a broken one ?

Check/update documentation

  • Check documentation if there is anything missing for a new contributor perspective.
  • Steps for local testing with local cluster

Validate istio schemas

--ignore-missing-schema was added to kubeconform to stop CI from failing for istio examples. It would be nice to have validation for istio schemas

Identify resources still TODO

  • Identify top-level resources that are still TODO
  • EndpointSlice
  • CSIDriver
  • CSINode
  • VolumeAttachment
  • PersistentVolumeClaim
  • ControllerRevision
  • ControllerRevisionList
  • CustomResourceDefinition โ€“ simplest example done: #48 ; TODO: add a custom resource being used example
  • Event
  • HorizontalPodAutoscalar
  • ValidatingAdmissionWebhook
  • MutatingAdmissionWebhook
  • PodDisruptionBudget
  • PriorityClass
  • PodPreset
  • Create folders for these with a README.md in each (empty is OK for now)

Add PodDisruptionBudget Example

We're missing an example for PodDisruptionBudget.

It should be possible to use an example from the Kubernetes docs.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

Add PodPreset Example

We're missing an example for PodPreset.

It should be possible to use an example from the Kubernetes docs.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

Add AdmissionWebhook Examples

Add examples for ValidatingAdmissionWebhook and MutatingAdmissionWebhook.

It should be possible to use examples from the Kubernetes docs, but please make sure they work standalone.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

Remove PodSecurityPolicy examples

PodSecurityPolicy is deprecated and will be removed from Kubernetes API in 1.25 release. We should remove the examples when it's removed from the API.

Add example for PersistentVolumeClaim

We're missing an example for PersistentVolumeClaim, but we do have one for PersistentVolumes. This example should probably go in the same directory.

It should be possible to use an example from the Kubernetes docs, but please make sure it works either standalone or with the existing PersistentVolume example.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

Validate missing schemas

--ignore-missing-schema was added to kubeconform to stop CI from failing for istio examples. This flag could be removed and istio resources can be ignored

Create template for new issues

For new issues, template should be created so that description would cover some basic questions like:
Bug or Feature Request/New Example Request
Bug: Which examples are affected?
Feature Request/New Example Request: Name of the resource kind and resource example is asked for

Add HorizontalPodAutoscaler Example

We're missing an example for HorizontalPodAutoscalar.

It should be possible to use an example from the Kubernetes docs.

If you want to pick up this issue, please first read the README.md and CONTRIBUTING.md. Make sure you follow the existing style and standards for other examples.

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.