Giter VIP home page Giter VIP logo

k8s_basics's Introduction

K8s Basics

This repo has some example config files for creating some basic resources in kubernetes.

namespace.yaml

This file creates a new namespace. Namespaces are sort of like folders on a hard disk. They can be used to group resources and set security boundaries.

Change the name value on line 4.

$ kubectl apply -f namespace.yaml

postgres.yaml

This file creates a single pod deployment running postgres. It assumes that you have already created the StorageClass, PersistentVolume, and PersistentVolumeClaim.

Update the namespace and claimName before running.

$ kubectl apply -f postgres.yaml

When the pod comes up it will have been assigned a dynamic IP address.

postgres-service.yaml

This file creates a DNS hostname on the cluster and a static IP address that other pods in your namespace can use to connect.

Update the namespace before running.

$ kubectl apply -f postgres-service.yaml

utils.yaml

This file creates a single pod deployment that can be used to connect to the postgres container. The dockerfile is available here and the container is hosted here

Update the namespace and claimName before running. Optionally you can remove the volume and volumeMount. These are there so that you can look at the filesystem of the PersistentVolumeClaim.

pv.yaml

This file creates a PersistentVolume. Think of a PersistentVolume like a hard drive. It attaches a hard drive to your cluster with the Storage Class you specify.

This is a cluster wide configuration and does not need a namespace.

Update the volumeHandle to match the EFS volume you created in the AWS EFS Console.

pvc.yaml

This file creates a PersistentVolumeClaim, or claim on some storage of a PersistentVolume. Think of it like a hard drive partition. You must partition your hard drive before you can put anything on it.

The pvc does get mapped to a namespace and makes the storage available to containers in that namespace.

If the PVC is deleted, the underlying storage can be either deleted or unbound depending on your settings, so be careful!

Change the name and namespace before running.

$ kubectl apply -f pvc.yaml

storageclass.yaml

Kubernetes clusters can be connected to lots of different storage backends. In the case of AWS two primary examples are EFS Elastic File System and EBS Elastic Block Store.

This file makes the kubernetes cluster aware of EFS via the provisioner and gives the storage class the name of efs-sc.

This is a cluster wide configuration and does not need a namespace.

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.