Hi,
I created a simple NGINX Dockerfile as follows :
FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
COPY content /usr/share/nginx/html
COPY conf /etc/nginx
The config for NGINX is nothing special:
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
index index.html index.htm;
}
}
I then created simple deployment.yaml
kind: Deployment
metadata:
name: test-deployment
namespace: default
labels:
k8s-app: testapp
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: simple
spec:
containers:
- name: nginx
image: quay.io/<MYACCOUNT_GOES_HERE>/<MYNGINX_GOES_HERE>:latest
ports:
- name: http
containerPort: 80
A simple service.yaml:
kind: Service
apiVersion: v1
metadata:
name: test-service
namespace: default
spec:
selector:
k8s-app: testapp
ports:
- protocol: TCP
port: 80
type: NodePort
And a simple ingress.yaml:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: "tectonic"
ingress.kubernetes.io/rewrite-target: /
ingress.kubernetes.io/ssl-redirect: "true"
ingress.kubernetes.io/use-port-in-redirects: "true"
spec:
rules:
- host: <MY_HOSTNAME_GOES_HERE>
http:
paths:
- path: /test-deployment
backend:
serviceName: test-service
servicePort: 8090
I have tried various versions of ingress.yaml. Changing servicePort to 8090 doesn't work. Simplyfing the ingress as follows doesn't work. I have tried both nodePort and clusterPort as the port number, that does't work.:
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: test-ingress
namespace: default
selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/test-ingress
uid: <MY_UUID>
resourceVersion: '52879'
generation: 10
creationTimestamp: '2018-02-19T13:18:24Z'
annotations:
kubernetes.io/ingress.class: tectonic
spec:
rules:
- host: <MY_HOST_NAME>
http:
paths:
- backend:
serviceName: test-service
servicePort: 80
status:
loadBalancer:
ingress:
- {}
$kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
test-deployment 1 1 1 1 2h
$kubectl get services -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
kubernetes ClusterIP 10.3.0.1 <none> 443/TCP 6h <none>
test-service NodePort 10.3.151.217 <none> 80:31803/TCP 2h <none>
$kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
test-ingress <mY_HOSTNAME> 80 2h