Skip to content

Instantly share code, notes, and snippets.

View matthewpalmer's full-sized avatar

Matthew Palmer matthewpalmer

View GitHub Profile
@matthewpalmer
matthewpalmer / volume.yaml
Created October 21, 2018 20:37
Kubernetes volume example 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
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
kind: Pod
apiVersion: v1
metadata:
name: banana-app
labels:
app: banana
spec:
containers:
- name: banana-app
image: hashicorp/http-echo
kind: Pod
apiVersion: v1
metadata:
name: apple-app
labels:
app: apple
spec:
containers:
- name: apple-app
image: hashicorp/http-echo
kind: Pod
apiVersion: v1
metadata:
name: example-pod
spec:
containers:
- image: nginx
name: example-container
# ~ ⟩ 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 July 22, 2018 01:27
overview of kubernetes port definitions
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 July 21, 2018 04:13
kubernetes nginx php-fpm pod
# 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 July 21, 2018 04:12
kubernetes php fpm nginx config
# 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 July 21, 2018 04:09
kubernetes php fpm nginx
# docker build . -t my-php-app:1.0.0
FROM php:7.2-fpm
RUN mkdir /app
COPY hello.php /app