dgkanatsios / CKAD-exercises

A set of exercises to prepare for Certified Kubernetes Application Developer exam by Cloud Native Computing Foundation
MIT License
8.77k stars 5.64k forks source link

Multi-container Pods issue #145

Closed amar-preet closed 4 years ago

amar-preet commented 4 years ago

In Multi-container Pods section the second question is throwing an error

apiVersion: v1
kind: Pod
metadata:
  labels:
    run: box
  name: box
spec:
  initContainers: #
  - args: #
    - /bin/sh #
    - -c #
    - wget -O /work-dir/index.html http://kubernetes.io #
    image: busybox #
    name: box #
    volumeMounts: #
    - name: vol #
      mountPath: /work-dir #
  containers:
  - image: nginx
    name: nginx
    ports:
    - containerPort: 80
    volumeMounts: #
    - name: vol #
      mountPath: /usr/share/nginx/html #
  volumes: #
  - name: vol #
    emptyDir: {} #

image

ismailyenigul commented 4 years ago

Hi, It fails because of the wget in busybox. wget can't handle HTTPS requests for kubernetes.io properly.

$ kubectl run bbox --image=busybox --restart=Never -it -- /bin/sh
 # wget http://kubernetes.io
Connecting to kubernetes.io (147.75.40.148:80)
Connecting to kubernetes.io (147.75.40.148:443)
wget: note: TLS certificate validation not implemented
wget: TLS error from peer (alert code 80): 80
wget: error getting response: Connection reset by peer

But it works for other websites like gnu.org

/ # wget -O index.html https://gnu.org
Connecting to gnu.org (209.51.188.148:443)
wget: note: TLS certificate validation not implemented
Connecting to www.gnu.org (209.51.188.148:443)
saving to 'index.html'
index.html           100% |**************************************************************************************************************| 31689  0:00:00 ETA
'index.html' saved

There is a PR at https://github.com/dgkanatsios/CKAD-exercises/pull/136/files about updating kubernetes.io with a working site.

dgkanatsios commented 4 years ago

Merged so closing this, feel free to re-open if the issue persists.