I have deployed a SAS Viya programming on a pod.This has SASStudio running on port 80. I am trying to expose the SAS Studio using the nodeport and Ingress through below yaml files. But in the GCP console, the backend service is displayed has unhealthy and if I try to access the Ip either it is hitting default backend or page not found. I am able to access the service using the cluster IP and node IP along with the port number.
If I use LoadBalancer service instead of Ingress, I am able to access the service using the Loadbalancer Ip.
When using the Ingress, the backend service is shown as unhealthy.
I have used the curl command with node Ip and nodeport Ip. Below is the result.
[root@k8jumphost doc]# curl -ILS "10.142.0.19:30100"
HTTP/1.1 302 Found
Date: Fri, 01 Feb 2019 07:53:31 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Location: http://10.142.0.19:30100/SASStudio
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 302
Date: Fri, 01 Feb 2019 07:53:32 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Location: /SASStudio/
Transfer-Encoding: chunked
HTTP/1.1 200
Date: Fri, 01 Feb 2019 07:53:34 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Content-Length: 7836
[root@k8jumphost doc]# cat sas-analytics-ingress.yaml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sas-programming-ingress
labels:
app: sas-programming
spec:
rules:
- host: sas-programming
http:
paths:
- path: /
backend:
serviceName: sas-programming-svc-nodeport
servicePort: 80
[root@k8jumphost doc]# cat sas-analytics-nodeport.yaml
---
apiVersion: v1
kind: Service
metadata:
name: sas-programming-svc-nodeport
labels:
app: sas-programming
spec:
selector:
app: sas-programming
ports:
- name: http
nodePort: 30100
port: 80
targetPort: 80
- name: cas
nodePort: 30200
port: 5570
targetPort: 5570
type: NodePort
[root@k8jumphost doc]# cat sas-analytics.yaml
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: sas-programming-deployment
labels:
app: sas-programming
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: sas-programming
spec:
securityContext:
fsGroup: 1001
hostname: sas-programming
containers:
- name: sas-programming
image: <location of the image>
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5570
- containerPort: 80
env:
- name: CASENV_CAS_VIRTUAL_HOST
value: "sas-programming"
- name: CASENV_CAS_VIRTUAL_PORT
value: "30300"
I suspect the redirection on the / is resulting this error. Can anyone please help me, what should be added to the deployment file to overcome this error.
I think the fact that your backend in GCP is unhealthy is indicative that you may not have health endpoint on your container. Have a look at https://kubernetes.io/docs/concepts/services-networking/ingress/#loadbalancing. You would need readinessProbe
and livenessProbe
in your deployment yaml.