Skip to content

Instantly share code, notes, and snippets.

@just1689
Created September 11, 2018 22:57
Show Gist options
  • Save just1689/d9ea5b2bb1e80003036cce9b0d2ff59e to your computer and use it in GitHub Desktop.
Save just1689/d9ea5b2bb1e80003036cce9b0d2ff59e to your computer and use it in GitHub Desktop.
Creating something and exposing it in K8s
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
spec:
selector:
matchLabels:
run: my-nginx
replicas: 2
template:
metadata:
labels:
run: my-nginx
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 80
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
spec:
backend:
serviceName: my-nginx
servicePort: 80
apiVersion: v1
kind: Service
metadata:
name: my-nginx
labels:
run: my-nginx
spec:
ports:
- port: 80
protocol: TCP
selector:
run: my-nginx
type: NodePort
@just1689
Copy link
Author

kubectl create -f deployment.yaml
kubectl create -f service.yaml
kubectl create -f ingress.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment