Complete the code to deploy a simple service in Kubernetes.
kubectl create deployment myapp --image=[1]The nginx image is a common lightweight web server used for simple service deployment.
Complete the command to expose the deployment as a service.
kubectl expose deployment myapp --type=[1] --port=80
LoadBalancer exposes the service externally using a cloud provider's load balancer.
Fix the error in the service mesh sidecar injection command.
kubectl label namespace default istio-injection=[1]To enable automatic sidecar injection, the label value must be enabled.
Fill both blanks to create a service mesh policy that allows traffic only from a specific service.
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: allow-specific
namespace: default
spec:
selector:
matchLabels:
app: [1]
rules:
- from:
- source:
principals: ["[2]"]The policy selects pods with label app: reviews and allows traffic only from the service account reviews in the default namespace.
Fill all three blanks to define a traffic routing rule in Istio VirtualService.
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: myapp
spec:
hosts:
- myapp.example.com
http:
- route:
- destination:
host: [1]
subset: [2]
weight: [3]The rule routes 80% of traffic to subset v1 of the host myapp.