Last active
November 13, 2024 21:09
-
-
Save res0nat0r/fb675bb79fe8f769f7c3762254dac270 to your computer and use it in GitHub Desktop.
Internal / External Kubernetes Service Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: test | |
labels: | |
app: test | |
spec: | |
replicas: 10 | |
selector: | |
matchLabels: | |
app: test | |
template: | |
metadata: | |
labels: | |
app: test | |
spec: | |
nodeSelector: | |
kubernetes.io/hostname: ip-10-0-172-177.us-west-2.compute.internal | |
containers: | |
- name: test | |
image: alpine | |
command: ['sh', '-c', 'sleep 6666666'] | |
resources: | |
requests: | |
memory: 1Gi | |
limits: | |
memory: 20Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: testing | |
spec: | |
nodeSelector: | |
kubernetes.io/hostname: ip-10-0-172-177.us-west-2.compute.internal | |
containers: | |
- name: testing | |
image: ubuntu | |
command: ['sh', '-c', 'sleep infinity'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: policy/v1 | |
kind: PodDisruptionBudget | |
metadata: | |
name: hello-world | |
spec: | |
minAvailable: 1 | |
selector: | |
matchLabels: | |
app: hello-world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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