Skip to content

Instantly share code, notes, and snippets.

@vmleon
Created August 24, 2020 16:14
Show Gist options
  • Save vmleon/d2e5bb64f8448c7bf628884f30f476f9 to your computer and use it in GitHub Desktop.
Save vmleon/d2e5bb64f8448c7bf628884f30f476f9 to your computer and use it in GitHub Desktop.
OKE Ingress Controller
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello
labels:
app: hello
spec:
selector:
matchLabels:
app: hello
replicas: 3
template:
metadata:
labels:
app: hello
spec:
containers:
- name: hello
image: scottsbaldwin/docker-hello-world:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hello-svc
spec:
selector:
app: hello
ports:
- port: 8088
targetPort: 80
type: ClusterIP
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello-ing
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- http:
paths:
- backend:
serviceName: hello-svc
servicePort: 8088
kubectl create clusterrolebinding victor_cluster_admin --clusterrole=cluster-admin --user=<user-OCID>
# clusterrolebinding.rbac.authorization.k8s.io/victor_cluster_admin created
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml
# namespace/ingress-nginx created
# configmap/nginx-configuration created
# configmap/tcp-services created
# configmap/udp-services created
# serviceaccount/nginx-ingress-serviceaccount created
# clusterrole.rbac.authorization.k8s.io/nginx-ingress-clusterrole created
# role.rbac.authorization.k8s.io/nginx-ingress-role created
# rolebinding.rbac.authorization.k8s.io/nginx-ingress-role-nisa-binding created
# clusterrolebinding.rbac.authorization.k8s.io/nginx-ingress-clusterrole-nisa-binding created
# deployment.apps/nginx-ingress-controller created
# limitrange/ingress-nginx created
# create cloud-generic.yaml (in this gist) and execute
kubectl apply -f cloud-generic.yaml
# service/ingress-nginx created
# check services
kubectl get svc -n ingress-nginx
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
# ingress-nginx LoadBalancer 10.96.156.115 133.153.34.123 80:32573/TCP,443:30002/TCP 62s
# create hello.yaml (in this gist) and execute
kubectl create -f hello.yaml
# deployment.apps/hello created
# service/hello-svc created
# create ingress.yaml (in this gist) and execute
kubectl create -f ingress.yaml
# ingress.networking.k8s.io/hello-ing created
# test with cURL
curl 133.153.34.123
# <h1>Hello webhook world from: hello-66487478d7-5ldbp</h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment