Last active
January 7, 2023 17:51
-
-
Save DrMartiner/d8eceb2bca0ef1c9ae6f851696eb21b5 to your computer and use it in GitHub Desktop.
k8s
This file contains hidden or 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
helm install first-release nginx-stable/nginx-ingress -n nginx-ingres | |
kubectl create ns test1 | |
kubectl apply -f deployment.yaml service.yml ingress.yml |
This file contains hidden or 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: test1 | |
namespace: test1 | |
spec: | |
selector: | |
matchLabels: | |
app: test1 | |
template: | |
metadata: | |
labels: | |
app: test1 | |
spec: | |
containers: | |
- name: test1 | |
image: nginx:latest | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 80 | |
lifecycle: | |
postStart: | |
exec: | |
command: ["/bin/bash", "-c", "echo 'myhost.com' > /usr/share/nginx/html/index.html"] |
This file contains hidden or 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: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: test1-ingress | |
annotations: | |
nginx.ingress.kubernetes.io/rewrite-target: / | |
spec: | |
rules: | |
- host: myhost.com # add myhost.com to /etc/hosts | |
http: | |
paths: | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: test1-service | |
port: | |
number: 80 |
This file contains hidden or 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: Service | |
metadata: | |
name: test1-service | |
namespace: test1 | |
labels: | |
app: test1 | |
spec: | |
type: ClusterIP | |
ports: | |
- port: 80 | |
targetPort: 80 | |
name: http | |
selector: | |
app: test1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment