Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
matthewpalmer / volume.yaml
Created Oct 21, 2018
Kubernetes volume example YAML
View volume.yaml
kind: Pod
apiVersion: v1
metadata:
name: simple-volume-pod
spec:
# Volumes are declared by the pod. They share its lifecycle
# and are communal across containers.
volumes:
# Volumes have a name and configuration based on the type of volume.
# In this example, we use the emptyDir volume type
View ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
View banana.yaml
kind: Pod
apiVersion: v1
metadata:
name: banana-app
labels:
app: banana
spec:
containers:
- name: banana-app
image: hashicorp/http-echo
View apple.yaml
kind: Pod
apiVersion: v1
metadata:
name: apple-app
labels:
app: apple
spec:
containers:
- name: apple-app
image: hashicorp/http-echo
View pod.yaml
kind: Pod
apiVersion: v1
metadata:
name: example-pod
spec:
containers:
- image: nginx
name: example-container
View config.yaml
# ~ ⟩ kubectl config view
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://localhost:6443
name: docker-for-desktop-cluster
- cluster:
certificate-authority: /Users/matthewpalmer/.minikube/ca.crt
server: https://192.168.99.100:8443
@matthewpalmer
matthewpalmer / service.yaml
Created Jul 22, 2018
overview of kubernetes port definitions
View service.yaml
kind: Service
apiVersion: v1
metadata:
name: port-example-svc
spec:
# Make the service externally visible via the node
type: NodePort
ports:
# Which port on the node is the service available through?
@matthewpalmer
matthewpalmer / pod.yaml
Created Jul 21, 2018
kubernetes nginx php-fpm pod
View pod.yaml
# Create a pod containing the PHP-FPM application (my-php-app)
# and nginx, each mounting the `shared-files` volume to their
# respective /var/www/html directories.
kind: Pod
apiVersion: v1
metadata:
name: phpfpm-nginx-example
spec:
volumes:
@matthewpalmer
matthewpalmer / configmap.yaml
Created Jul 21, 2018
kubernetes php fpm nginx config
View configmap.yaml
# First, create a ConfigMap whose contents are used
# as the nginx.conf file in the web server.
# This server uses /var/www/html as its
# root document directory. When the server gets a
# request for *.php, it will forward that request
# to our PHP-FPM container.
kind: ConfigMap
apiVersion: v1
metadata:
@matthewpalmer
matthewpalmer / Dockerfile
Created Jul 21, 2018
kubernetes php fpm nginx
View Dockerfile
# docker build . -t my-php-app:1.0.0
FROM php:7.2-fpm
RUN mkdir /app
COPY hello.php /app