Skip to content

Latest commit

 

History

History
168 lines (137 loc) · 3.48 KB

25-Practice-Test-CKA-Ingress-Net-2.md

File metadata and controls

168 lines (137 loc) · 3.48 KB

Practice Test CKA Ingress 2

Solution

  1. Check the Solution

    OK
    
  2. Check the Solution

    kubectl create namespace ingress-space
    
  3. Check the Solution

    kubectl create configmap nginx-configuration --namespace ingress-space
    
  4. Check the Solution

    kubectl create serviceaccount ingress-serviceaccount --namespace ingress-space
    
  5. Check the Solution

    Ok
    
    kubectl get roles,rolebindings --namespace ingress-space
    
  6. Check the Solution

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: ingress-controller
      namespace: ingress-space
    spec:
      replicas: 1
      selector:
        matchLabels:
          name: nginx-ingress
      template:
        metadata:
          labels:
            name: nginx-ingress
        spec:
          serviceAccountName: ingress-serviceaccount
          containers:
            - name: nginx-ingress-controller
              image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.21.0
              args:
                - /nginx-ingress-controller
                - --configmap=$(POD_NAMESPACE)/nginx-configuration
                - --default-backend-service=app-space/default-http-backend
              env:
                - name: POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
                - name: POD_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.namespace
              ports:
                - name: http
                  containerPort: 80
                - name: https
                  containerPort: 443
    
  7. Check the Solution

    apiVersion: v1
    kind: Service
    metadata:
      name: ingress
      namespace: ingress-space
    spec:
      type: NodePort
      ports:
      - port: 80
        targetPort: 80
        protocol: TCP
        nodePort: 30080
        name: http
      - port: 443
        targetPort: 443
        protocol: TCP
        name: https
      selector:
        name: nginx-ingress
    
  8. Check the Solution

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-wear-watch
      namespace: app-space
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
        nginx.ingress.kubernetes.io/ssl-redirect: "false"
    spec:
      rules:
      - http:
          paths:
          - path: /wear
            pathType: Prefix
            backend:
              service:
               name: wear-service
               port: 
                number: 8080
          - path: /watch
            pathType: Prefix
            backend:
              service:
               name: video-service
               port:
                number: 8080
    
    
  9. Check the Solution

    OK