Skip to content

Instantly share code, notes, and snippets.

@res0nat0r
Last active July 1, 2023 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save res0nat0r/fb675bb79fe8f769f7c3762254dac270 to your computer and use it in GitHub Desktop.
Save res0nat0r/fb675bb79fe8f769f7c3762254dac270 to your computer and use it in GitHub Desktop.
Internal / External Kubernetes Service Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: app
image: paulbouwer/hello-kubernetes:1.9
ports:
- name: web
containerPort: 8080
protocol: TCP
kind: Service
apiVersion: v1
metadata:
name: hello-world-internal
namespace: default
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
spec:
type: LoadBalancer
selector:
app: hello-world
ports:
- name: http
protocol: TCP
port: 80
targetPort: web
kind: Service
apiVersion: v1
metadata:
name: hello-world
namespace: default
spec:
type: LoadBalancer
selector:
app: hello-world
ports:
- name: http
protocol: TCP
port: 80
targetPort: web
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: hello-world
spec:
minAvailable: 1
selector:
matchLabels:
app: hello-world
apiVersion: apps/v1
kind: Deployment
metadata:
name: stefhen
spec:
replicas: 1
selector:
matchLabels:
app: stefhen
template:
metadata:
labels:
app: stefhen
spec:
containers:
- name: ubuntu
image: ubuntu
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "apt-get update -qq && apt-get install -y -qq curl wget httpie screen bind9-host"]
command: ["/bin/sh", "-c", "sleep infinity"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment