3919d666c1
The requirements for network policy feature are described here [1]. In order to enable it, appropriate configuration must be provided to the CNI plug in and Calico policy controller must be set up. Beside that corresponding extensions needed to be enabled in k8s API. Now to turn on the feature user can define `enable_network_policy` customization variable for Ansible. [1] http://kubernetes.io/docs/user-guide/networkpolicies/
40 lines
1.3 KiB
Django/Jinja
40 lines
1.3 KiB
Django/Jinja
apiVersion: extensions/v1beta1
|
|
kind: ReplicaSet
|
|
metadata:
|
|
name: calico-policy-controller
|
|
namespace: kube-system
|
|
labels:
|
|
k8s-app: calico-policy
|
|
kubernetes.io/cluster-service: "true"
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
kubernetes.io/cluster-service: "true"
|
|
k8s-app: calico-policy
|
|
template:
|
|
metadata:
|
|
name: calico-policy-controller
|
|
namespace: kube-system
|
|
labels:
|
|
kubernetes.io/cluster-service: "true"
|
|
k8s-app: calico-policy
|
|
spec:
|
|
hostNetwork: true
|
|
containers:
|
|
- name: calico-policy-controller
|
|
image: calico/kube-policy-controller:latest
|
|
env:
|
|
- name: ETCD_ENDPOINTS
|
|
value: "{{ etcd_endpoint }}"
|
|
# Location of the Kubernetes API - this shouldn't need to be
|
|
# changed so long as it is used in conjunction with
|
|
# CONFIGURE_ETC_HOSTS="true".
|
|
- name: K8S_API
|
|
value: "https://kubernetes.default:443"
|
|
# Configure /etc/hosts within the container to resolve
|
|
# the kubernetes.default Service to the correct clusterIP
|
|
# using the environment provided by the kubelet.
|
|
# This removes the need for KubeDNS to resolve the Service.
|
|
- name: CONFIGURE_ETC_HOSTS
|
|
value: "true"
|