No longer able to access interactively using Kubernetes 1.18.8
Hi guys I'm no longer able to access the container using Kubernetes. The following yaml file is based on the one you provided (https://github.com/ConSol/docker-headless-vnc-container/blob/master/kubernetes/kubernetes.headless-vnc.example.deployment.yaml) with the added things necessary to support Kubernetes version 1.18.8 plus the security context
#### POD config (run one time)
apiVersion: apps/v1
kind: Deployment
metadata:
name: headless-vnc
labels:
application: headless-vnc
spec:
# 1 Pods should exist at all times.
replicas: 1
selector:
matchLabels:
app: headless-vnc
template:
metadata:
labels:
app: headless-vnc
spec:
terminationGracePeriodSeconds: 5
containers:
- name: headless-vnc
image: consol/centos-xfce-vnc
imagePullPolicy: Always
args:
### make normal UI startup to connect via: oc rsh <pod-name> bash
#- '--tail-log'
### checks that vnc server is up and running
securityContext:
runAsUser: 0
livenessProbe:
tcpSocket:
port: 5901
initialDelaySeconds: 1
timeoutSeconds: 1
### checks if http-vnc connection is working
readinessProbe:
httpGet:
path: /
port: 6901
scheme: HTTP
initialDelaySeconds: 1
timeoutSeconds: 1
---
apiVersion: v1
kind: Service
metadata:
labels:
application: headless-vnc
name: headless-vnc
spec:
externalName: headless-vnc
ports:
- name: http-port-tcp
protocol: TCP
port: 6901
targetPort: 6901
nodePort: 31001
- name: vnc-port-tcp
protocol: TCP
port: 5901
targetPort: 5901
nodePort: 31002
selector:
application: headless-vnc
type: NodePort
# Use type loadbalancer if needed
# type: LoadBalancer
Apparently the container is running, I can connect to it, everything seems to work, but accessing directly through the browser or a vnc client is not working. The site don't respond. Do you know what could be the reason?
I'm using Kubernetes version 1.18.8 as it came with latest Docker Desktop. Previous version of Kubernetes worked fine but this one, besides force me to change the yaml, now the interactive access don't work.
Thanks!
Create svc via:
# kubectl run vnc1 --image=consol/centos-xfce-vnc:latest --port=5901 --expose
service/vnc1 created
pod/vnc1 created
Edit svc for exposing svc with NodePort:
# kubectl edit svc vnc1
Change type: ClusterIP to type: NodePort
Your svc will be like:
# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.233.0.1 <none> 443/TCP 174m
vnc1 NodePort 10.233.49.126 <none> 5901:32098/TCP 38s
Via vncviewer YOURIP:32098 you could reach the vnc session running in pod.