The hands on tutorial on Katacoda isn't working correctly
mel-splunk opened this issue · 15 comments
Myself and a teammate tried installing version 1.4 a kubeinvaders. In both our cases we could not switch between namespaces. We just got switched to namespace undefined when trying to switch namespaces. We both correctly configured target_namespace to point to one or more namespaces already ready with multiple pods. Therefore we ran the hands on demo on katacoda and had the same issue. You may want to fix the walk through and would be interested in how it was resolved since running into the same issue when installing it. I installed the legacy version and that one seems to more properly set up the target namespaces as I can switch between the target namespaces configured and do not get undefined namespace. However with Legacy version I still do not see the pods in the namespace to shoot at
Hi @mel-splunk Thank you very much for using KubeInvaders. I tried right now installing whith this params:
helm install kubeinvaders ./helm-charts/kubeinvaders
--set image.tag=v1.4
--namespace kubeinvaders
--set service.type=NodePort
--set ingress.enabled=false
--set target_namespace="default,more-apps"
--set ingress.hostName=2886795302-30016-ollie08.environments.katacoda.com
It works correctly. Can you please try using my example and changing your ingress.hostName? Please do not forget the fix for NodePort described into the scenario.
Regards,
Eugenio
Thanks @mel-splunk!
I just tried the scenario without modifications and I was able to flip between namespaces and saw the pods and not seeing "undefined" namespace. I'm switching between the two namespaces just fine, with no undefined namespace. You must add an escape slash in the set command before each comma that separates the namespaces. No whitespace. Other than that, I'm not clear on your specific reproducible steps.
Based on your proposed changes:
- The
image.tag=v1.4
is the current default for the chart so that is not needed. - The ingress hostname is different for each Katacoda instance, and it should not be hardcoded, the numbers there were for your specific ephemeral instance. The actual values are calculated when the instance starts using this template:
--set ingress.hostName=[[HOST_SUBDOMAIN]]-30016-[[KATACODA_HOST]].environments.katacoda.com
- If you remove the slash in the namespace list setting:
--set target_namespace="default,more-apps"
The chart will not install with this error:
Error: failed parsing --set data: key "more-apps" has no value
So it must be with escaping slash before comma(s):
--set target_namespace="default\,more-apps"
This is an old known issue with helm --set parameters described here.
This points to the real underlying issue. In the chart settings, the namespaces list should be an array type, not a string type. See this article in the Arrays section.
I just bumped the Katacoda instance from K8s v 1.18 to 1.21 and updated the game plan keys in the text.
Hi @javajon thank you!
@mel-splunk can I close the issue?
@mel-splunk - are you still having an issue? I didn't fix anything related to your finding as I was not able to reproduce what you reported. I tried to clarify the settings. If you are continuing to experience a problem just provide some exact steps to reproduce.
Hi @javajon
Here are steps that I am following and getting the error @mel-splunk mentioned:
kubectl version --short && \ kubectl get componentstatus && \ kubectl get nodes && \ kubectl cluster-info
Output:
Client Version: v1.14.0
Server Version: v1.14.0
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health":"true"}
NAME STATUS ROLES AGE VERSION
controlplane Ready master 63m v1.14.0
node01 Ready <none> 62m v1.14.0
Kubernetes master is running at https://172.17.0.37:6443
KubeDNS is running at https://172.17.0.37:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
-
helm version --short
Output:v3.1.2+gd878d4d
-
kubectl create namespace kubeinvaders
-
git clone https://github.com/lucky-sideburn/KubeInvaders && cd KubeInvaders
-
helm install kubeinvaders ./helm-charts/kubeinvaders \ --version 0.1.1 \ --namespace kubeinvaders \ --set service.type=NodePort \ --set ingress.enabled=false \ --set target_namespace="default\,more-apps" \ --set route_host=2886795301-30016-ollie09.environments.katacoda.com
-
kubectl patch service kubeinvaders -n kubeinvaders --type='json' --patch='[{"op": "replace", "path": "/spec/ports/0/nodePort", "value":30016}]'
-
kubectl create deployment nginx --image=nginx
-
kubectl scale deployment/nginx --replicas=8
-
kubectl create namespace more-apps
-
kubectl create deployment ghost --namespace more-apps --image=ghost:3.11.0-alpine
-
kubectl scale deployment/ghost --namespace more-apps --replicas=4
-
kubectl label deployment,pod app-purpose=chaos -l app=nginx --namespace default
-
kubectl label deployment,pod app-purpose=chaos -l app=ghost --namespace more-apps
-
watch kubectl get deployments,pods --all-namespaces -l app-purpose=chaos
output:
Every 2.0s: kubectl get deployments,pods --all-namespaces -l app-purpose=chaos Wed Jul 7 17:06:29 2021
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
default deployment.extensions/nginx 8/8 8 8 7m23s
more-apps deployment.extensions/ghost 4/4 4 4 6m53s
NAMESPACE NAME READY STATUS RESTARTS AGE
default pod/nginx-65f88748fd-6w5dv 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-cx5xl 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-fzfz8 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-gh59g 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-h4k4g 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-ntt42 1/1 Running 0 7m23s
default pod/nginx-65f88748fd-tr2fx 1/1 Running 0 7m12s
default pod/nginx-65f88748fd-wvd2s 1/1 Running 0 7m12s
more-apps pod/ghost-577f44b678-kv7td 1/1 Running 0 6m53s
more-apps pod/ghost-577f44b678-m4q2m 1/1 Running 0 6m44s
more-apps pod/ghost-577f44b678-rfb84 1/1 Running 0 6m44s
more-apps pod/ghost-577f44b678-wstqb 1/1 Running 0 6m44s
Hi @maulikp-splunk I am sorry I found the problem. It is route_host that I don't use anymore... I will fix it
@maulikp-splunk can you please try with ingress.hostName instead of route_host?
Thanks @lucky-sideburn ! Replacing route_host with ingress.hostName during helm installation worked!
Hi @SionArtingstall can you please show to me from the web developer tools for your browser which are the http requests that are failing?
Thanks
E
@lucky-sideburn - I am trying to run this demo on my docker-desktop kubernetes instance and seems like it's showing Current Namespace: undefined
because SSL API calls are failing due to cert error (ERR_CERT_AUTHORITY_INVALID). Is there anyway that I can update kubeinvaders.js
to ignore SSL errors and rebuild the image?
@lucky-sideburn looks like a cors issue
kubeinvaders.js:199 GET https://kuebinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/kube/nodes net::ERR_FAILED
getNodes @ kubeinvaders.js:199
getKubeItems @ kubeinvaders.js:207
kubeinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/:1 Access to XMLHttpRequest at 'https://kuebinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/kube/pods?action=list&namespace=undefined' from origin 'https://kubeinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
kubeinvaders.js:180 GET https://kuebinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/kube/pods?action=list&namespace=undefined net::ERR_FAILED
getPods @ kubeinvaders.js:180
getKubeItems @ kubeinvaders.js:208
kubeinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/:1 Access to XMLHttpRequest at 'https://kuebinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud/kube/nodes' from origin 'https://kubeinvaders-kubeinvaders.redhaterchaos-ecf58268eb10995f067698dffc82d2a7-0000.eu-gb.containers.appdomain.cloud' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Please try with the latest helm chart. Below how to proceed.
When you use K8s with Ingress Controller
helm repo add kubeinvaders https://lucky-sideburn.github.io/helm-charts/
kubectl create namespace kubeinvaders
helm install kubeinvaders --set-string target_namespace="namespace1\,namespace2" \
-n kubeinvaders kubeinvaders/kubeinvaders --set ingress.hostName=kubeinvaders.io --set image.tag=v1.7
@SionArtingstall I have no tested yet KubeInvaders on Openshift 4.x :) Please try with this new version and check if there is some url different from subdomain.domain.com that the game calls. From the logs you sent me it seems ok, the host are the same. Check also https://docs.openshift.com/container-platform/4.7/security/allowing-javascript-access-api-server.html
@maulikp-splunk you should to add an exception for the self signed certificate exposed by the game or add you certificate into the ingress (you can customize the values.yaml for example writing attributes into the tls section of the ingress definition). I am using firefox and I have no problems
Hi! I close this issue due to inactivity.
Into the version v1.9 there are many UI improvements as described here.
Thanks!